Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Jasmine VanExel
Jasmine VanExel
3,515 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
216,812 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 10,734 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
216,812 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.