How do i get gloveBoxContents to equal maps?

Tell us what’s happening:

Your code so far


// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

var gloveBoxContents = myStorage.car.inside'maps'; // Change this line

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects

here some example
var a={ "b":{ "c":"here is C" } }

let getCstring=a.b.c

Hi!
You have to reach maps, so what it the complete path to get to maps?
myStorage :arrow_forward: car :arrow_forward: inside :arrow_forward: … and?

so here’s what i put:

var gloveBoxContents = mystorage.car.inside.glovebox.maps

and its still not right… it says maps is undefined

You are very close!

Two tips:

  1. maps is what you need to get, so you don´t have to write it. You are setting this var so it gives maps as result.
  2. Do you remember if you have to use dot or bracket notation when you work with words space separated?

i figured it out!

var gloveBoxContents = mystorage.car.inside[“glove box”]
thanks for the hints!

1 Like