I’m making a two-dimensional array like this:
var array = [];
array.push(["plus", "alpha"]);
array.push(["john", "doe"]);
array.push(["christina", "aguilera"]);
And so if I run a command like this:
trace(array[2][0]);
It should give me:
christina
Right. Now, if I:
trace(array.length);
What would I get? My theories:
- Considering this is a two-dimensional array, it would give me the length of all arrays included in the array, thus it would trace 6.
- This itself is one array, the elements are arrays too; but that does not matter, so it would give me 3.
Which one of the above is right?
Or both are wrong? What will it give me then?
Thanks! 🙂
Length should be 3. Because you are creating multidimensional array. Each dimension has it own length.