title: JavaScript set object key by variable
body: <p>I am building some objects in JavaScript and pushing those objects into an array, I am storing the key I want to use in a variable then creating my objects like so:</p>
  
  <pre><code>var key = "happyCount";
  myArray.push( { key : someValueArray } );
  </code></pre>
  
  <p>but when I try to examine my array of objects for every object the key is <code>"key"</code> instead of the value of the variable key. Is there any way to set the value of the key from a variable? </p>
  
  <p>Fiddle for better explanation:
  <a href="http://jsfiddle.net/Fr6eY/3/" rel="noreferrer">http://jsfiddle.net/Fr6eY/3/</a></p>