Immediately accessing an object's property
<p>Given these four examples of defining an object and then attempting to immediately access their properties:</p>

<pre><code>{foo: 'bar'}.foo
// syntax error: unexpected_token
</code></pre>

<p>I expected this would return the value of 'foo', but it results in a syntax error.</p>

<p>The only explanation I can come up with is that the object definition hasn't been executed and therefore is not yet an object. It seems that the object definition is therefore ignored and the syntax error comes from attempting to execute just:</p>

<pre><code>.foo
// results in the same syntax error: unexpected_token
</code></pre>

<p>Similarly:</p>

<pre><code>{foo: 'bar'}['foo']
// returns the new Array ['foo']
</code></pre>

<p>Which seems to be evidence that the object literal is ignored and the trailing code is executed.</p>

<p>These, however, work fine:</p>

<pre><code>({foo: 'bar'}).foo
// 'bar'

({foo: 'bar'})['foo']
// 'bar'
</code></pre>

<p>The parentheses are used to run the line of code and since the result of that parenthetical operator is the instantiated object, you can access properties.</p>

<p>So, why is the object definition ignored and not executed immediately?</p>
