Accessing Nested Objects help!

Accessing Nested Objects help!
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 = "maps"; // Change this line
myStorage.car.inside[glove box];

Your browser information:

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

Link to the challenge:


#2

[quote=“Naiguy1, post:1, topic:153848”]
I dont know why it is not working’


#3

You have two problems with your existing code:

  1. First, just like in the challenge example, where the “top drawer” property was referenced, you must surround properties with spaces in their names with quotes/double quotes or you will get an error.

  2. You can not just assign “maps” to gloveBoxContents to complete this challenge. You must assign the value of the “glove box” property using the myStorage object (with the applicable dot and/or bracket notation to get the “glove box” property to gloveBoxContents. You need to combine the two lines of your code into one line.