Why this code is not working

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[“glove box”];

// Change this line
console.log(gloveBoxContents);

and the console shows this message:

SyntaxError: unknown: Unexpected character ‘“’ (16:44)

14 |
15 |

16 | var gloveBoxContents = myStorage.car.inside[“glove box”];
| ^
Your browser information:

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

Challenge: Accessing Nested Objects

Link to the challenge:

1 Like

Look carefully at the quotes you are using here. You should be using either be using straight double quotes or straight single quotes. You are using curly quotes, which are invalid in JavaScript.

2 Likes