Basic JavaScript - Accessing Nested Objects

Hello i am trying to pass this challenge but i donot know what the issue is
in my code the error is that you shiould use dot and braket notation to access myStorage

Your code so far

const myStorage = {
  "car": {
    "inside": {
      "gloveBoxContents": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
    
  }
  
};
const gloveBoxContents = myStorage.car.inside.gloveBoxContents;

Your browser information:

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

Challenge: Basic JavaScript - Accessing Nested Objects

Link to the challenge:

This part looks good. You are accessing the myStorage object. Inside of the myStorage object there is a car object. And inside of the car object there is an inside object.

Now read the directions carefully again:

“…assign the contents of the glove box property to the gloveBoxContents variable.”

Do you see the glove box property inside of the inside object? That’s the property you want to access and assign its value to the gloveBoxContents variable. The tricky issue is that the glove box property has a space in it. So how do you access a property with a space in it?

So just to repeat, you have most of this correct. The following it good:

const gloveBoxContents = myStorage.car.inside

It’s the last part, the glove box part that you need to add. It’s not going to be gloveBoxContents. That’s not a name of a property inside the inside object. The name of the property you want to access is glove box.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.