title: JavaScript 'hoisting'
body: <p>I came across JavaScript 'hoisting' and I didn't figure out how this snippet of code really functions:</p>
  
  <pre><code>var a = 1;
  
  function b() {
      a = 10;
      return;
  
      function a() {}
  }
  
  b();
  alert(a);
  </code></pre>
  
  <p>I know that function declaration like ( <code>function a() {}</code> ) is going to be hoisted to the top of the function <code>b</code> scope but it should not override the value of <code>a</code> (because function declarations override variable declarations but not variable initialization) so I expected that the value of the alert would be 10 instead of 1!!</p>