Accessing Nested Objects2

Accessing Nested Objects2
0

#1

My code so far

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

For some reason it isn’t working. Can someone help me please?


#2

The original code had var gloveBoxContents = ""; and your code below the “Only change code below this line” should be set to that variable they have.


#3

you need to give it something to return the

myStorage.car.inside["glove box"]; //

like setting a div, and put the contents in
like:

<p id="demo"></p>
<!-- and in the <script> : --->
<script>
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
}; // Only change code below this line
document.getElementById("demo").innerHTML =myStorage.car.inside["glove box"]; // Change this line
</script>



#4

Thank you. That worked.