title: How To Set A JS object property name from a variable
body: <p>I am in need to set a JS object property name dynamically.</p>
  
  <pre><code>for(i=1; i&lt;3; i++) {
      var key  = i+'name';
  
      data = {
          key : 'name1',
      }
  }
  </code></pre>
  
  <p>Result should be:</p>
  
  <pre><code>data = {
      1name: 'name1'
      2name: 'name1'
  }
  </code></pre>