newbiescooby
Technical User
Hi
I'm trying to set a 2d array and it's not working correctly.
my code is:
var ContentArray = new Array(9); //Define array
for(var i=0;i<=9;i++)
{
ContentArray = new Array(9); // create 2d array
}
ContentArray[0,0]="1";
ContentArray[0,1]="2";
ContentArray[1,0]="3";
alert(ContentArray[0,0] + " " + ContentArray[0,1] + " " + ContentArray[1,0]);
but the alertbox brings back 3 2 3, so it seems to be writing the 2nd column in value in all rows.
Canb someone help me out and tell me why each cell is not independant?
I'm trying to set a 2d array and it's not working correctly.
my code is:
var ContentArray = new Array(9); //Define array
for(var i=0;i<=9;i++)
{
ContentArray = new Array(9); // create 2d array
}
ContentArray[0,0]="1";
ContentArray[0,1]="2";
ContentArray[1,0]="3";
alert(ContentArray[0,0] + " " + ContentArray[0,1] + " " + ContentArray[1,0]);
but the alertbox brings back 3 2 3, so it seems to be writing the 2nd column in value in all rows.
Canb someone help me out and tell me why each cell is not independant?