title: Java Script Scoping
body: <p>Js community I am new in JS and I have a confusion with JS scopes in this example I have an if statement and I defined inside the block var age and this a local scope then I console log this variable age and I got 25 this is why? is it because of the if statement is defined globally so what is defined inside the block is global too? one more thing I noticed the age variable is attached to the global object which is the window I logged it and I found the age var but I am not sure why this is happening?</p>
  
  <pre><code>if(true){
      var age = 25;
  }
  
  console.log(age);
  </code></pre>