Can anyone show me a demo of this challenge

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 = ""; // 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/66.0.3359.139 Safari/537.36.

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

myStorage.car.inside[“glove box”] -> and you get maps. Notice that i used both .(dot) and [""] to access data element. I did that because “glove box” element have a space between strings of that sub-element. If was glove_box, it would be: myStorage.car.inside.glove_box -> and you get maps.

It’s a matter of chaining accessor until you reach your desired “destination”.

You know that I can use both . (dot notation) or [] (square brackets)

var myObj = {
  one: 1,
  two: 2,
}

myObj.two // 2
myObj["one"] // 1

Chaining them will lead you to the desired value:

var myObj = {
  one: {
    two: {
      three: ['a', 'b', 'c']
    }
  }
}

myObj.one // { two: {...} }
myObj.one.two // { three: {...} }
myObj.one.two.three // [ ... ]
myObj.one.two.three[0] // 'a'

Hope it helps :slight_smile: