How to add dynamic attribute to an Object in JavaScript?
<p>How to add dynamic attribute to an object, for example I use the following code to add index (<code>index</code>)attribute to <code>myObj</code>, <code>index</code> is a variable.</p>

<pre><code>var myObj={};
for(var index=0; index&lt;10; index++){
   myObj[index]='my'+index;
}
</code></pre>

<p>But it does not work...</p>
