how can I declare a value deep in an object tree using variable properties in javascript
<p>I am trying to have a javascript object tree behave like a php associative array in the following way.</p>

<pre><code>var key1 = 'a';
var key2 = 'b';
var key3 = 'c';

var obj[key1][key2][key3] = 'd';
</code></pre>

<p>However, in javascript I believe you need to define each property/object pair individually, forming deeper leaves. Something like:</p>

<pre><code>var obj[key1] = {};
var obj[key1][key2] = {};
...
</code></pre>

<p>Is there a way to simplify or shorten this script?</p>

<p>Thanks</p>
