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.
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.