title: What does "var FOO = FOO || {}" (assign a variable or an empty object to that variable) mean in Javascript?
body: <p>Looking at an online source code I came across this at the top of several source files.</p>
  
  <pre><code>var FOO = FOO || {};
  FOO.Bar = …;
  </code></pre>
  
  <p>But I have no idea what <code>|| {}</code> does.</p>
  
  <p>I know <code>{}</code> is equal to <code>new Object()</code> and I think the <code>||</code> is for something like "if it already exists use its value else use the new object.</p>
  
  <p>Why would I see this at the top of a source file?</p>