Arrays and Objects in JS


#1


https://www.codecademy.com/courses/javascript-beginner-en-9Sgpi/1/2?curriculum_id=506324b3a7dffd00020bf661#

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]];
console.log(newArray)


#2

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)


#3

thanks i oversaw that


#4

nevermind same problem


#5

can i see an updated version of your code?


#6

var newArray= [[1, 1, 1],[1, 1, 1][1, 1, 1]];
console.log(newArray)


#7

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]];

#8

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


#10

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