title: How can I access a JavaScript object which has spaces in the object's key?
body: <p>I have a JavaScript object that looks something like this:</p>
  
  <pre><code>var myTextOptions = {
    'cartoon': {
       comic: 'Calvin &amp; Hobbes',
       published: '1993'
    },
    'character names': {
      kid: 'Calvin',
      tiger: 'Hobbes'
    }
  }
  </code></pre>
  
  <p>I can access the properties of <code>cartoon</code> easily using <code>myTextOptions.cartoon.comic</code> or whatever. However, I haven't been able to get the syntax right for accessing <code>kid</code>. I've tried the following with no luck:</p>
  
  <pre><code>myTextOptions.character names.kid
  myTextOptions."character names".kid
  myTextOptions.character\ names.kid
  myTextOptions.'character names'.kid
  myTextOptions.["character names"].kid
  myTextOptions.character%20names.kid
  </code></pre>