Basic JavaScript - Accessing Nested Objects

This is basically the example in the “Accessing Nested Objects Lesson”

I just have a question as to why the bracket notation “” is on the “top drawer”?

I was wondering why we can choose bracketing the “cabinet” or “folder1”?

Thank you very much.

In other words, what exactly is the selecting in this process?

Your code so far

  "desk": {
    "drawer": "stapler"
  "cabinet": {
    "top drawer": { 
      "folder1": "a file",
      "folder2": "secrets"
    "bottom drawer": "soda"

ourStorage.cabinet["top drawer"].folder2;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0

Challenge: Basic JavaScript - Accessing Nested Objects

Link to the challenge:

It is selecting the “top drawer” object

This would just the content what object it selects:

ourStorage.cabinet[“top drawer”].folder2would be the stringsecrets, and ourStorage.desk.drawerwould be the stringstapler`.

I have answered your question. Please reread the response or you can ask me to explain something if you don’t understand what an object is.

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