I want to create an array from an existing array in order to modify the new array without affecting the old one. I understand that arrays are mutable, and so the new array affects the old one.
eg.
old = ["Apples", "Bananas"]; new = old; new.reverse();
The old one was also canceled.
In Python, I can just do new = list(old) , but doing new = new Array(old); puts the old list inside the list.
javascript
jdborg Mar 30 '13 at 19:15 2013-03-30 19:15
source share