Help with arrays inside arrays!


#1

Hello guys !

I'm stuck I can't understand what they mean by : "It should have three rows and three columns". What do they mean by columns ? here is my code :

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

Thanks for helping !


#2

this part was really weird but I think that the columns are how many elements are in the three inside arrays. try adding another number into each array.


#3

Ah, nested arrays :slight_smile: .

So, if you where to loop through each array inside the outer array it would look like so.

11
11
11

Visually, it has three rows and two columns.

if you did myArray = [[1,1,1],[1,1,1],[1,1,1]] and logged each array inside the outer array it would look like below.


111
111
111

Visually, it has three rows and three columns.


#4

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