15. multidimensional array(unexpected token [ )


#1


not sure why i'm getting this error "SyntaxError: Unexpected token [ " .Is there something wrong in this piece of code that i have to change?

The instruction given was:
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!


here's the code:

var object=new Object();

    object.name="keerthi";
    object.age=15;

var newArray[[3,8],[object,4]];


i'm really struck up .Please help me solve it.


#2

Both inner arrays are still the same length. Add a couple of numbers to either array.


#3

thanks a lot.It worked out.


#4

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