title: if (x) ... gives Reference Error: x is not defined
body: <p>I thought the following would work, whether <code>x</code> is declared or assigned a value or not:</p>
  
  <pre><code>if (x)
     console.log("x is well defined");
  else
     console.log("x is not defined or null or false or 0 ...");
  </code></pre>
  
  <p>However, I am getting (when <code>x</code> is nowhere declared in my code):</p>
  
  <blockquote>
    <p>x is not defined</p>
  </blockquote>
  
  <p>Why does this happen?</p>
  
  <p>(This is in a Node.js environment.)</p>