title: What's the difference between window.x and x?
body: <p>Let's say, "x" is a variable that never defined, so it should be undefined. In the following scenario:<br>
  1)</p>
  
  <pre><code>if(x){//do something}
  //ReferenceError: x is not defined
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>if(window.x){//do something}
  //worked as expected
  </code></pre>
  
  <p>As far as I know, in browser environment here, x should be the same as window.x, could anyone help to point out the reason for the different behavior here?</p>