I have to add some value to an array.
Code for example :
temp[0]=new Array("0","0");
temp[1]=new Array("0","0");
temp[2]=new Array("0","0");
temp[3]=new Array("0","0");
temp[4]=new Array("0","0");
vt=new Array("1","0");
temp.splice(3, 0, vt);
temp.splice(4, 0, vt);
temp[3][1]="R";
I expect this output :
1 - 0,0 2 - 0,0 3 - 0,0 4 - 1,R 5 - 1,0 6 - 0,0 7 - 0,0
But the actual output is:
1 - 0,0 2 - 0,0 3 - 0,0 4 - 1,R 5 - 1,R 6 - 0,0 7 - 0,0
Any idea? I think it's an indexing problem with splice()
function!