Accessing Nested Objects in Javascript

Accessing Nested Objects in Javascript
0

#1

I am stuck at this code. I have been using bracket and sot notation to access the value of glove box , but still facing some errors. Please help me out with this line of code.

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 = "myStorage.car.inside['glove box']"; // Change this line

Your browser information:

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

Link to the challenge:


#2

right now, as you have it, gloveBoxContents is assigned a string value of "myStorage.car.inside['glove box']" the reason is because you have quotations around the variable assignment , is there any reason why you put in the quotations ?


#3

deleting quotations is also giving an error.


#4

what is the error you are getting? You should not be getting any

https://repl.it/@Dee3/JoyfulKnowledgeableAndeancockoftherock


#5

Make sure you are only deleting the outermost double quotes you used in the following line of code. The single quotes should remain.

"myStorage.car.inside['glove box']"