15 – Multidimensional arrays


Make an array called newArray. It should be 2D (that is, it should contain two elements that, in turn, are arrays) and jagged (those two arrays should be of different lengths, like in the example above). The ultimate kicker? Make one of your inner arrays contain an object!

I created a multidimensional array as per the instructions:

myObject = new Object();
var myArray = [[0, 1, 2], [1, myObject]];

However, when I submit it, an error is thrown:

Oops, try again. It looks like your first two rows are the same length. Make them different!

I don't see how the first two rows are the same length. What is wrong with my code?


Problem was that I used myArray instead of newArray. Whoops.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.