Arrays and Objects in JS


What am i doing wrong?
this is the error message:
Oops, try again. It looks like newArray has fewer than three rows.

var newArray= [[1, 1, 1][1, 1, 1][1, 1, 1]];


this array (lets call it out array) contains other arrays (lets call them inner arrays)

normal when you add elements to your (outer) array, you separate the elements with comma's:

myArray = [1,2,3]

when you add (inner) arrays to your (outer) array, you should separate the inner arrays with comma's (the inner arrays are still just elements inside the outer array)


thanks i oversaw that


nevermind same problem


can i see an updated version of your code?


var newArray= [[1, 1, 1],[1, 1, 1][1, 1, 1]];


you added a comma between first and second element:

[[1, 1, 1],[1, 1, 1]

to separate the list elements, but what about the second and third element:

[1, 1, 1][1, 1, 1]];


i quit my life.........


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