Tis no work why? does i not work?

Tell us what’s happening:

TypeError: Cannot read property ‘pine’ of undefined

Your code so far

// Setup
var myPlants = [
  type: "flowers",
  list: [
  type: "trees",
  list: [

// Only change code below this line

var secondTree = myPlants[1].trees["pine"]; // 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.121 Safari/537.36.

Challenge: Accessing Nested Arrays

Link to the challenge:

myPlants[1] does not have a key named trees, it has just type and list


Hi @Senkora

As mentioned in problem you should only use dots and brackets for accessing the value
Also you cannot provide string value for accessing the value using brackets.

provide index values instead :slightly_smiling_face:

1 Like