quote:
Originally posted by Mattike
quote:
Originally posted by L. Coyote
I once needed this type of array and had to do this:
code:
var arr = new Array();
arr[0] = new Array();
arr[0][0] = "blah";
That's also the way I do it. I have no idea how JScript would react if you try to add an array element to an array element which is undefined at that moment... Maybe I should try it.
Another way you could do it, would be:
code:
var arr = new Array(new Array("thing", "stuff"), new Array("crap", "blah"));
Both ways are exactly the same
quote:
Originally posted by tryxter
Multidimensional arrays aren't well explained on MS documentation.
Because they don't exist in JScript.
JScript does not support multidimensional arrays (which is well explained in the help page on the Array object).
To
simulate multidimensional arrays you need to define a new array as part of another array element.
Hence, arr[0][0] isn't a multidemensional array (which would be only one object), it is an array which consists of other arrays (which are 1 +
number of elements objects), which is quite different.