title: Add dynamic key, value pairs to JavaScript array or hash table
body: <p>I'm trying to add a key value pair to an existing javascript associative array. The key needs to be a variable. This is for JSON encoding. I realize there are many plugins and frameworks for this, but I want a simple answer.</p>
  
  <pre><code>ary.push({name: val});
  </code></pre>
  
  <p>where <code>ary</code> is a new array, <code>name</code> is a variable containing the key, <code>val</code> is the value of this entry.</p>
  
  <p>I'm doing this in a <code>jQuery</code> loop that iterates through form fields.</p>