title: How can I push a dynamic object into array?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2855473/javascript-expression-to-define-objects-property-name">Javascript expression to define object’s property name?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to add objects to an array, but I want to have the name and value to be dynamic. Here's an example:</p>
  
  <pre><code>    (function(){
          var data = [];
  
          for(i=0; i&lt;5; i++){
              data.push({'name' + i: i});
      }
  
          console.log(data);
      })()
  </code></pre>
  
  <p>I guess I can't use a variable for the property so I'm not sure what to do.</p>