title: How does this javascript object array work?
body: <p>I am trying to understand something very basic. If I have an object like this:</p>
  
  <pre><code>var topics = {}
  </code></pre>
  
  <p>And I do this:</p>
  
  <pre><code>topics[name] = ["chapter 1", "chapter 2", "chapter 3"];
  </code></pre>
  
  <p>When I log this object, I don't see the name attribute. What have I done exactly? Have I created a key called name with the value of an array?</p>
  
  <p>Of course I know I can do that by just doing</p>
  
  <pre><code>topics.name =  ["chapter 1", "chapter 2", "chapter 3"];
  </code></pre>
  
  <p>But then what is this doing?</p>
  
  <pre><code>topics[name] = ["chapter 1", "chapter 2", "chapter 3"];
  </code></pre>
  
  <p>Could someone please clarify?</p>