6. Arrays of arrays - Arrays and Objects in JS


#1

Hey there,

Just a little confused at the instructions here:
If you were to put a new line between the two rows, you could log a 2D object—a square—to the console, like so:

Regarding the example code: var twoDimensional = [[1, 1], [1, 1]]; how do you put a 'line' between the two rows to make a square?

I could only make a square when i used a for loop, like so:
for (var i =0; i < newArray.length; i++) {
console.log(newArray[i]);
}

Thanks in advance!


#2

@tyoungg I don't think they meant to literally put a line between the rows, I think they were just trying to express how the 2D object would look -- just like you made it with your for loop.


#3

var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];

for (i=0; iconsole.log(languages[i]);
}

console.log(languages[0], languages[1], languages[2], languages[3], languages[4]);


#12