0
What's wrong with my array?
Please check the code https://code.sololearn.com/W0z7zI82F3Kp/?ref=app
2 Antworten
+ 1
Quick Answer :
Push a copy of z instead, with
z.slice()
https://code.sololearn.com/WLD9cbMKKPMv/?ref=app
Explanation :
Because you are adding the reference of z instead of the value of z to a,
that's why when z changes, all elements of a is changed.
https://www.sololearn.com/post/136566/?ref=app
https://www.sololearn.com/post/136211/?ref=app
More in :
https://code.sololearn.com/WKKkpq0efxai/?ref=app
0
Gordon thank you very much, man!