ga-wdi-exercises / project1

[project] GA- Project 1
3 stars 75 forks source link

issue with nested loop iterations #262

Closed ghost closed 8 years ago

ghost commented 8 years ago

I tried to create "n" disks of "k" colors and push to an array.

I expected the array to contain the disks created in the loop, especially since logging each iteration of the loop (both the disk created, and what's being pushed to the array) show me the "nth" disk of "k"

Instead the destination array is showing n*k copies of the final disk created in the destination array - and the detailed information for each individual object is also showing that the objects are not taking the values assigned during the loop.

My repo link is https://github.com/tedwards1884/Towers-of-Hanoi/blob/master/main.js and my question is about lines 49-68.

ghost commented 8 years ago

Found a workaround by inserting each iteration of the loop directly into the DOM