JavaScript property access: dot notation vs. brackets?
<p>Other than the obvious fact that the first form could use a variable and not just a string literal, is there any reason to use one over the other, and if so under which cases?</p>

<p>In code:</p>

<pre><code>// Given:
var foo = {'bar': 'baz'};

// Then
var x = foo['bar'];

// vs. 
var x = foo.bar;
</code></pre>

<p>Context: I've written a code generator which produces these expressions and I'm wondering which is preferable.</p>
