Accessing Nested Objects11

Accessing Nested Objects11
0

whats the error:

Your code so far


// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};
myStorage.car.inside["glove box"];
var gloveBoxContents = "maps"; // Change this line

Your browser information:

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

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

What is going on? What are you trying to do? What part do you need help with? What errors are you experiencing? What else have you tried while attempting to solve the problem?

So these two lines need to be combined. First line shouldn’t be there at all, though that’s the exact path you want to use to get the value into the variable gloveBoxContents.

Can you see a way to combine them?

No I can not see.Please help me.

The test is not completed.error message is Use dot and bracket notation to access my storage.

This is the line you need to edit, at this time you are just assigning a string to the variable, you instead need to assign a value from the object. Here you need to access the desired value inside the object to assign it to the variable

So, in the above, the first line shouldn’t be doing anything. It points to the proper place, but it’s not being saved to a variable, or sent to the console, or anything. That line does nothing, shouldn’t even be there.

The second line, however, you’re declaring a variable, then you’re actually putting the string here. Not what they’re wanting. Instead, change that line:

var gloveBoxContents = myStorage./* what should you put here to point to the value 'maps'?? */;
// I'll give you a hint - what was the line that you removed? Use that in the above line, and you'll pass!