Nested Objects in JavaScript

What are the nested objects in this code? If its desk cabinet and top drawer why do they look like the property side of a key/value pair? It’s confusing to see a nested object not look the object ourStorage.

Thanks

const ourStorage = {
  "desk": {
    "drawer": "stapler"
  },
  "cabinet": {
    "top drawer": { 
      "folder1": "a file",
      "folder2": "secrets"
    },
    "bottom drawer": "soda"
  }
};

ourStorage.cabinet[“top drawer”].folder2;
ourStorage.desk.drawer;

Like i said,I think the objects are desk, cabinet, and top drawer. I think that because they are set up before the curly brackets that have key/value pairs inside but that doesn’t seem right because they look like the property side of a key value pair?

So are there more objects in this code? Can you also consider drawer, folder1, folder 2, and bottom drawer objects? Or does the fact that property is assigned a value make that just a property of an object and not object. Or is that all properties are also in fact objects? Is Bottom drawer a nested object/property of the object ourStorage with the value of soda?

Or does the bracket notation determine if a property is an object?

Thanks

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