title: javascript object push how to set key value
body: <p>Is there any way to set own key value when using javascript push method? Here is my example:</p>
  
  <pre><code>  &lt;script&gt;
    var examples = [];
    &lt;/script&gt;  
  
    &lt;?php foreach($examples as $example):?&gt;
    &lt;script type="text/javascript"&gt;
    var example&lt;?php echo $example['id']?&gt; = { 
      id : '&lt;?php echo $example['id']?&gt;',
      another : '&lt;?php echo $example['another']?&gt;',
    };
    //here I would like to give key $example[id]
    examples.push(example&lt;?php echo $example['id']?&gt;);
    &lt;/script&gt;  
    &lt;?php endforeach;?&gt;
  
    &lt;script&gt;  
      for (index = 0; index &lt; examples.length; ++index) {
          somefunction(examples[index]);  
      }                            
    &lt;/script&gt;
  </code></pre>
  
  <p>For some reasons I need $example['id'] to have the same value as pushed key.</p>