Syntax of javascript object

Tell us what’s happening:
I have just started learning javascript and in a earlier challenge(link of the challenge is"https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects")I learnt that javascript objects start with curly braces"{ }" but in this challenge javascript object starts with big bracket “[ ]”. I have checked by the (typeof) feature and console is showing that “myPlants” is an object.Can anyone help me regarding this bracket problem?

Your code so far


// Setup
var myPlants = [
{
  type: "flowers",
  list: [
    "rose",
    "tulip",
    "dandelion"
  ]
},
{
  type: "trees",
  list: [
    "fir",
    "pine",
    "birch"
  ]
}
];

// Only change code below this line

var secondTree = ""; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36.

Challenge: Accessing Nested Arrays

Link to the challenge:

Yes javascript objects are enclosed in {} but there are also different types of objects in javascript. One of them is called an array and the items in it are eclosed in []. Read more about different objects in javascript at w3schools

hi there @codingninja80

you need to defind a variable called secondTree that will access the second tree in the second array (trees)
remember that Javascript arrays etc are zero based, i.e the first place in the list will be counted az zero
example: rose- 0 tulip- 1 and so on

so the first element “flowers” is zero, and the “trees” will be 1

hope that helps

in case you are completely stuck:

var secondTree = myPlants[1].list[1];