171
rated 0 times
[
174]
[
3]
/ answers: 1 / hits: 36062
/ 12 Years ago, thu, january 24, 2013, 12:00:00
I'm trying to create a copy of existing array and remove some items from array copy without impacting the original. I've tried this :
var new_arr = old_arr; //when I remove from new array the items from old array are also removed
How do I create entirely new copy of the existing array?
Update :
When I do this :
var new_arr = old_arr.slice();
then later :
new_arr[0].shift();
new_arr[1].shift();
The items from old_array get removed. This is a two dimensional array.
More From » javascript