title: javascript best practice define variable (namespace) check is not already defined
body: <p>Wanted to get opinions from the experts, I am declaring a variable that will act as the namespace for my application javascript code, but i want to check it is not already defined.</p>
  
  <p>this code is terse and 'seems' to work - any reason I should avoid this and use typeof 'undef' checking instead?</p>
  
  <pre><code>var MY_NAMESPACE = MY_NAMESPACE || {};
  </code></pre>
  
  <p>Thanks</p>