JavaScript Object-Oriented JavaScript: Challenge Making the Game Interactive playToken() Method Solution

Richard Preske
PRO
Richard Preske
Pro Student 4,054 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
194,935 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
Pro Student 4,054 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
194,935 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.