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 trial

JavaScript Object-Oriented JavaScript: Challenge Rendering the Game startGame() Method Solution

Jasmine VanExel
Jasmine VanExel
3,522 Points

Game not starting; getting eror

Uncaught ReferenceError: index is not defined at new Token (Token.js:4:28) at Player.createTokens (Player.js:15:21) at new Player (Player.js:7:24) at Game.createPlayers (Game.js:14:26) at new Game (Game.js:4:29) at app.js:1:14 Token @ Token.js:4 createTokens @ Player.js:15 Player @ Player.js:7 createPlayers @ Game.js:14 Game @ Game.js:4 (anonymous) @ app.js:1

Steven Parker
Steven Parker
231,236 Points

You need to supply more information to replicate the issue (like the actual code). Take a look at this video about Posting a Question, and perhaps also this one about sharing a snapshot of your workspace.

Steven Vallarsa
seal-mask
.a{fill-rule:evenodd;}techdegree
Steven Vallarsa
Full Stack JavaScript Techdegree Student 14,699 Points

Same thing happened to me. I don't know if I was just not following along the instructions properly, but I created a for loop with an iterator of "i", but used "index" in the "new Token(index, this) call. I changed "index" to "i" and I moved on to my next error.

1 Answer

Steven Parker
Steven Parker
231,236 Points

As Steven Vallarsa suggested, check on line 28 of Token.js in case you accidentally used the name "index" where you intended to use the name of a variable already declared. If that doesn't resolve the issue, post the actual code (via a link to a snapshot) so we can take a closer look.