Dynamically assign name to object array
<p>I have a javascript issue. <br/>
If I have an object array objAr, the object consists of id,name.</p>

<p>If I was to access <code>objAr[0].id</code> it returns the id value of the first object. What would happen if the object is dynamic and therefore I do not know what it consists of, is there a way to dynamically call the Object attribute?</p>

<p>Currently I am creating another array</p>

<pre><code>var theArr = new Array("id", "name");
</code></pre>

<p>and call:</p>

<pre><code>objAr[0].theArr[0] instead of objAr[0].id.
</code></pre>

<p>Is there a way to do this better using Javascript?</p>
