Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPatricia Padilla
5,026 PointsUncaught TypeError: this.activePlayer.activeToken.moveRight is not a function at Game.handleKeydown
Everything goes ok until a press the left arrow and then an uncaught typeError appears: Game.js:57 Uncaught TypeError: this.activePlayer.activeToken.moveRight is not a function at Game.handleKeydown (Game.js:57) at HTMLDocument.<anonymous> (app.js:15) I don't know why it fives me this error. Can anyone help please?
3 Answers
Steven Parker
231,184 PointsA common generic cause of this error is trying to access an attribute/method on a null or undefined variable. Check the value of "activePlayer" or "activePlayer.activeToken".
If you'd like more specific help, make a snapshot of your workspace and post the link to it here.
Patricia Padilla
5,026 PointsThanks Steven, I'll take a look and get it working. :)
Cory Aston
6,058 PointsIn my case I got this error because I forgot to save the Token.js file before I ran the code - so literally that function didn't exist! Duh! Took me a couple minutes to figure out why that wasn't working.