'Number is not a function' Error


In lesson 6.9, Create a Game, I have students that are getting an error code. When they click the left or right button on the circuit playground, it will say “number is not a function”, and references line 8 or 13 (depending on which one they click). We are confused about what the ‘number’ is and what needs to be adjusted. Thank you.



In lines 4 and 5 the student has declared variables as scoreR and scoreL then attempts to create functions with the same names. When the function is placed in the event handler, you are getting that error because the program is looking at the number variable. If you change the function name (scoreLFunc) in both places… declaring and within the event handler - the code will work.

As a side note, the student can also put everything inside of the function, and then just call the entire function on button pressed - right now the function is just a conditional. Looks good otherwise (also was excited to score so many points so quickly!)



Awesome, thank you for the assistance!