title: Dynamically creating keys in a JavaScript associative array
body: <p>All the documentation I've found so far is to update keys that are already created:</p>
  <pre><code> arr['key'] = val;
  </code></pre>
  <p>I have a string like this: <code>&quot; name =  oscar &quot; </code></p>
  <p>And I want to end up with something like this:</p>
  <pre><code>{ name: 'whatever' }
  </code></pre>
  <p>That is, split the string and get the first element, and then put that in a dictionary.</p>
  <h3>Code</h3>
  <pre><code>var text = ' name = oscar '
  var dict = new Array();
  var keyValuePair = text.split(' = ');
  dict[ keyValuePair[0] ] = 'whatever';
  alert( dict ); // Prints nothing.
  </code></pre>