So currently I have an Array here, and I want to make some modification of the last item and push it back it. Here I have this code: (example is simplified)
var array = [
[ [0,1,2], [3,4,5] ]
];
//other stuff...
var add = array[0].slice(); //to clone the array (but not working as expected)
add[0][0] = 10;
array.push(add);
console.log(array);
And here's the result
As you can see, both the 1st and 2nd item have its first item changed to 10
. How can I solve this problem? I have already cloned the array.