Why is this object creation practice used?
<pre><code>var obj;
if (!obj) obj = {};

obj.foo = {};

// ...
</code></pre>

<p>I see this in the beginning of source code all the time. I don't understand why someone would want to resort to such an unnecessary approach to creating an object. As per the if statement, of course it's going to evaluate to true because <code>obj</code> is undefined. So why do people want to create their objects this way? Is there so sort of benefit I don't know about?</p>
