title: Global variable returned as undefined when it is again declared locally in a block and referred before the declaration in the block.
body: <pre><code>var a = 10;
  function example(){
      alert(a);
      var a = 5;    
  }
  example();
  </code></pre>
  
  <p>This code alerts undefined.</p>
  
  <p>My question is why variable a is alerting "undefined" instead of returning global variable's value.</p>
  
  <p>My thanks to everyone in advance. I hope someone will clarify it for me.</p>