title: JavaScript Logic Guide
body: <p>I have small function logically output should be 1 but i am getting 10 .. Can any one help me out with this logic.</p>
  
  <pre><code>var a=1;
  function foo() {
      if(!a){
          var a=10;
      }
      console.log(a);
  }
  foo();
  </code></pre>
  
  <p>Output is coming 10 not 1 . how.</p>