title: JavaScript check if variable exists (is defined/initialized)
body: <p>Which method of checking if a variable has been initialized is better/correct?
  (Assuming the variable could hold anything (string, int, object, function, etc.))</p>
  <pre><code>if (elem) { // or !elem
  </code></pre>
  <p>or</p>
  <pre><code>if (typeof elem !== 'undefined') {
  </code></pre>
  <p>or</p>
  <pre><code>if (elem != null) {
  </code></pre>