I have a 2 dimensional array, with integers, and all what I want is to increment a particular item with a number. The initial state:
var arr1=[];
var arr2=[1,2,3];
arr1.push(arr2);
arr1.push(arr2);
arr1.push(arr2);
arr1 now looks like this:
0:[1, 2, 3]
1:[1, 2, 3]
2:[1, 2, 3]
What I want is to increment the [0,0] element of this array with 10, so arr1 should be:
0:[11, 2, 3]
1:[1, 2, 3]
2:[1, 2, 3]
What I did:
arr1[0][0]+=10;
But this way the result is:
0:[11,2,3]
1:[11,2,3]
2:[11,2,3]
What am I missing? Why increments this command all the numbers at position 0 of the array elements?