How to use variable name in object? : <p>I want to access the value of my object but with a <code>.var</code>. 
For example, if I specifiy the full path by myself it's <code>apple = theApples.trees.green</code> but I want to do:  </p>

<pre><code>var colorOfApple = "red";
apple = theApples.trees.colorOfApple;
</code></pre>

<p>the problem is it tries to access <code>.colorOfApple</code> of the object but I want to have the value of <code>colorOfApple</code> </p>
