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

Richard Preske
PLUS
Richard Preske
Courses Plus Student 4,355 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
218,816 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,355 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
218,816 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.