title: if (a) {} throws uncaughtReferenceError
body: <p>I need to be able to check if a variable exists (if if it doesn't assign it to {}) without throwing an error in javascript.  When I try this code</p>
  
  <pre><code>if (a) {}    
  </code></pre>
  
  <p>it throws uncaughtReferenceError</p>
  
  <p>What I really want to do is something like this without throwing an error:</p>
  
  <pre><code>a = a || {}    
  </code></pre>
  
  <p>or maybe it looks like this</p>
  
  <pre><code>if (a) { a = {} }    
  </code></pre>