Unit 3 Lesson 17 - Error Code

My student was out for the majority of Unit 3 and is now trying to finish up his work before the end of the year. For this lesson, the following error code appears:

ERROR: Line: 14: TypeError: Cannot read property ‘toString’ of undefined

The program won’t run when I give it a try. Any suggestions?

I did a remix on this and just put quotation marks around “score” in line 14 and it ran for me. Give that a shot.

On lines 31 & 36, your student is redeclaring score (something that has already been done on line 7 where they declared it and set it equal to zero.)

It should be declared on line 7, but any future reference to it should be without the “var” statement, so “score = score + 1;” and not “var score = score +1;”

This should fix it, but don’t hesitate to check back if something is still not working.



1 Like