title: Javascript: how to create an object with numeric String keys
body: <p>I need to create an object in javascript, similar to the following structure:</p>
  
  <pre><code>{ 
    '1': { 
      'key1-1': 'val1-1',
      'key-1-2': 'val1-2'
    }, 
    '2': { 
      'key1-1': 'val1-1',
      'key1-2': 'val1-2'
    }
  }
  </code></pre>
  
  <p>I tried with Object(); but the key remains the literal name of the variable.</p>
  
  <pre><code>&gt; var myObj = new Object();
  &gt; for (var i  = 1; i&lt; 5; i++) {
  ... myObj.i = {'key1-1': 'val1-1',
  .....         'key-1-2': 'val1-2'}
  ... }
  &gt; console.log(myObj)
  { i: { 'key1-1': 'val1-1', 'key-1-2': 'val1-2' } }
  </code></pre>
  
  <p>Tried converting the variable i to string but still the same.</p>
  
  <pre><code>&gt; for (var i  = 1; i&lt; 5; i++) {
  ... var iStr = i.toString();
  ... myObj.iStr = {'key1-1': 'val1-1',
  ..... 'key-1-2': 'val1-2'}
  ... }
  &gt; console.log(myObj)
  { iStr: { 'key1-1': 'val1-1', 'key-1-2': 'val1-2' } }
  </code></pre>
  
  <p>How can we create a json Object with numeric string keys like '1', '2', '3' ...</p>