Type Error: Number is not a function

csd-unit-3
csd-unit-3-lesson-22

#1

My student can’t get this error to go away. Please help! Here is the code: https://studio.code.org/projects/gamelab/TCMmFFs7KPxnj6Yjuls6ZqzxvHP7kl07VyUyLkeSClk

Thanks!


#2

Hi Mindy,

This type of error means that the program is treating something like a function when it’s actually a number. Usually this happens because there was a function name that also got used as a variable name, and a number was stored into the variable. In this case, that function/variable is score.

score is defined is a function in line 66, but it’s also being used as a number in lines 2 and 100. Line 100 has a warning telling the student that ‘score’ is already being used as a function. When the function score is called, score has already been redefined as a number, and the program can’t run the function.

To fix this problem, the student should used different names for the score function and score variable`.

Elizabeth