Accessing Nested Objects-FreeCodeCamp

Tell us what’s happening:

The code doesn’t work. I used the dot notation and bracket notation but I’m not sure of the issue.

Your code so far


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

var gloveBoxContents = myStorage.car.inside["glove box"]'maps'; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) 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/

Why do you just have the string 'maps' tacked on at the end of your lookup?

You are trying to reach into the glovebox so that should be where you stop at.

var gloveBoxContents = myStorage.car.inside["glove box"]  
 //Don't need to add the .maps at the end

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.