6. Arrays of arrays


#1

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

Hi,

According to the feedback I got this exercise right, but could this be made esthetically better? It has "officially" three rows in the code, but in the black box it has only 2.

var newArray = [["Aamu", "Saana", 9000], ["Aalto", 2000, 6000],
               [1000000, "Heidi", "metsä"]];

console.log(newArray);

I have tried to move the arrays inside the main/outer array/brackets, but it does not seem to help. I understood that when printed on the black box it should look nice and even like it really has 3 even rows.


#2

Hello :slight_smile:

I would use this style:

var newArray = [
  ["Aamu", "Saana", 9000],
  ["Aalto", 2000, 6000],
  [1000000, "Heidi", "metsä"]
];

console.log(newArray);

Now it's clear that there are 3 arrays inside main array and everything is nicely aligned.


#3

thank you very much this really helped