Why can't one object's property value be used as a property name in another object?
<p>The following gives me an error in my JS console (firebug):</p>

<pre><code>var obj1 = {name:'king', val:20}, obj2, objName = obj1.name;
obj2 = {obj1.name:obj1.val};
</code></pre>

<p>But the following works just fine:</p>

<pre><code>var obj1 = {name:'king', val:20}, obj2, objName = obj1.name;
obj2 = {objName:obj1.val};
</code></pre>

<p>The exact error is: "missing : after property id".  I don't need a work-around, I'm curious to know what the problem is here.</p>
