Stuck again,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
myStorage.inside["glove box"].passenger seat; // "crumbs"
myStorage.car.jack;

var gloveBoxContents = "maps"; // Change this line

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.2991.0 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/accessing-nested-objects

This one’s close! Just note that the myStorage object doesn’t have immediate access to the inside object. You’ll have to access the inside object via the car object first.

Second, .passenger seat is not right. Aside from the fact that ...['glove box'] holds a string (and the string that you’re after for to boot!), not an object, you should use bracket notation to access properties with spaces in them (you’ve already done so with glove box).

Now you just have to assign it to the gloveBoxContents variable.

1 Like

var gloveBoxContents = myStorage.car.inside[“glove box”];
//This is it.