title: How can I determine if a variable is 'undefined' or 'null'?
body: <p>How do I determine if variable is <code>undefined</code> or <code>null</code>?</p>
  
  <p>My code is as follows:</p>
  
  <pre class="lang-js prettyprint-override"><code>var EmpName = $("div#esd-names div#name").attr('class');
  if(EmpName == 'undefined'){
    // DO SOMETHING
  };
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div id="esd-names"&gt;
    &lt;div id="name"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  
  
  <p>But if I do this, the JavaScript interpreter halts execution.</p>