title: JavaScript isset() equivalent
body: <p>In PHP you can do <code>if(isset($array['foo'])) { ... }</code>. In JavaScript you often use <code>if(array.foo) { ... }</code> to do the same, but this is not exactly the same statement. The condition will also evaluate to false if <code>array.foo</code> does exists but is <code>false</code> or <code>0</code> (and probably other values as well).</p>
  <p>What is the perfect equivalent of PHP's <code>isset</code> in JavaScript?</p>
  <p>In a broader sense, a general, complete guide on JavaScript's handling of variables that don't exist, variables without a value, etc. would be convenient.</p>
  <hr />
  <p><strong>Update</strong>: 11 years and 11 months ago I posted this question, and wow, it still gets a lot of activity. Now, I'm pretty sure that when I wrote this, I only wanted to know how to check for the presence of a property in an associative array (a.k.a. dictionary), and as such the correct (for me) answers involve <code>hasOwnProperty</code> or the <code>in</code> operator. I wasn't interested in checking local or global variables.</p>
  <p>But while I remember that well, that intent is not quite clear in the question as written, or even directly contradicted by it! I never mentioned the associative array, and PHP's <code>isset</code> does also do those other things. Let this be a lesson to all of us about how important it is to properly state your requirements in a question, and also how global variables, local variables, object properties, dictionary keys and what-have-you aren't Huey, Dewey, and Louie.</p>
  <p>In the meantime (heh), many many people have provided answers to that effect as well, so for those of you who found this question through Google, well, I'm glad my vagueness helped in a way I guess. Anyway, just wanted to clarify that.</p>