In javascript, which is better `var Obj = Obj || {}` or `if (Obj === 'undefined' || typeof Obj !== 'object')`
<p>I want to know which of these methods is better:</p>

<pre><code>var Obj = Obj || {};
</code></pre>

<p>or</p>

<pre><code>if (Obj === undefined || typeof Obj !== 'object') {
  Obj = {};
}
</code></pre>

<p>I've been told that the 2nd method is better, but I don't know why. Please can you explain to me what are pros and cons of each.</p>

<p>Many thanks</p>
