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 Making the Game Interactive playToken() Method Solution

Richard Preske
PLUS
Richard Preske
Courses Plus Student 4,356 Points

drop token not working

https://w.trhou.se/v0w5snd0jd

targetColumn not iterable in playToken() method. This causes the drop token not to work.

1 Answer

Steven Parker
Steven Parker
231,269 Points

The "spaces" array currently has only one column The code that creates the column in Board.js at line 9 should be inside the loop instead of before it. Oddly, there's a commented-out statement in the right location at line 11!

And the code that adds the column to the main array at line 18 should also be inside the loop instead of after it.

Richard Preske
Richard Preske
Courses Plus Student 4,356 Points

Line 41 is where the issue lies. Are we looking at the same code here? line 9 in Game.js is const players. I don't see no commented out statement either on line 11.

Steven Parker
Steven Parker
231,269 Points

The error occurs later in Game.js when you move to a column that has not been set up.
But the problem is where the board is created in Board.js.