Score in game causes error code, even though same code for score works in previous level/lessons
Link to the project or level:https://studio.code.org/projects/gamelab/xJdz4IZggqtm0Zu9wFoYHftMhulWZhNw8upHZa63I9s What I expect to happen: score shows during game play What actually happens:* ERROR: Line: 12: TypeError: Cannot read property ‘toString’ of undefined What I’ve (& two other students) tried: copy/paste code from working score game, build code again, switching browsers, logoff/login
Lines 5 & 39 both try to declare the variable “score”. Try removing the var block from line 39 and only having it say “score=score+1” (without the “var”).
You don’t want to define a variable twice, because the code won’t know which variable to use, thus the error. if you remove the var on line 39, it should work.