Accessing Nested Objects!

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

Your browser information:

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

Link to the challenge:

1 Like

You’re not wrong in that your line of code will produce the right output.

In the same way var gloveBoxContents = myStorage["car"]["inside"]["glove box"]; would work to give you the right solution but not pass their tests, they are looking for a specific solution with a mixture of dot and bracket notation where you don’t have to use bracket notation unless you have spaces in the object’s key.

i tray to use your way bracket nation and still dose not work

Like @v-lai said above, to pass this challenge, you need to use dot notation where you can and only use bracket notation for object properties with spaces. Your latest solution of:

var gloveBoxContents = myStorage.['car']['inside']['glove box'];

uses bracket notation for all properties.

HINT: Only one of the above properties needs bracket notation.

var gloveBoxContents =[“glove box”]; // “maps”

1 Like