Array issue

hi javascript people,

I am trying to create an multidimensional array but every time I create it I get errors that [0][0] is undefined
can anyone point tell me where I am going wrong

var currentOrder = [];
currentOrder[0]= new Array(0);
currentOrder[1]= new Array(1);
currentOrder[2]= new Array(2);
currentOrder[3]= new Array(3);
currentOrder[4]= new Array(4);
currentOrder[5]= new Array(5);	 

With new Array(X), X = the number of elements in that array, so what are you trying to do with new Array(0)?

Also, with

currentOrder[5]= new Array(5);

The last element in that row will be [5][4] because array indexes start at 0 not 1.

A 2 dimensional array is simply an array of arrays.


currentOrder[0]= new Array(0);


currentOrder[0]= new Array(1);

(or more than 1 element if you need more)