0
Help with my code
Can anyone help me with the JS part of my code? for some reason, when I push the array, it does something that causes it to do something weird, something that I can't really explain, but it's caused by the .splice, which doesn't really logically make sense. can anyone help me? https://code.sololearn.com/Wa71a0A5A92a
2 Answers
+ 2
you are making a 2d array, by filling row with same subarray at each: fill() method use argument reference and don't make deep copy of it...
that's why when you modify one row, all rows are affected ;)
some modifications to your code to make it nearest of your probable purpose:
https://code.sololearn.com/WT8KB3cR8t9W/?ref=app
0
visph thank you so much I will change that