check for undefined variable
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2559318/how-to-check-for-undefined-or-null-variable-in-javascript">How to check for undefined or null variable in javascript</a>  </p>
</blockquote>



<p>I want to check for an defined variable in javascript. Please see the following few examples and help me which is the best method to check 'a' for undefined (and check for nothing else) in Javascript?</p>

<p>one</p>

<blockquote>
  <p>if(a === undefined) { ... }</p>
</blockquote>

<p>second</p>

<blockquote>
  <p>if(a === "undefined") { ... }</p>
</blockquote>

<p>third</p>

<blockquote>
  <p>if(typeof a == "undefined") { ... }</p>
</blockquote>

<p>last</p>

<blockquote>
  <p>if(a) { ... }</p>
</blockquote>
