Accessing Nested Objects in object section

Accessing Nested Objects in object section
0.0 0

#1

Tell us what’s happening:

Your code so far

// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line

var gloveBoxContents = "glove box"; // Change this line
myStorage.car.inside[gloveBoxContents];

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:


#2

Use bracket notation to access the “glove box” key, and set the gloveBoxContents variable to it. You only need one line.

var gloveBoxContents = myStorage.car.inside[ PUT KEY NAME HERE];