title: Javascript function scoping and hoisting
body: <p>I just read a great article about <a href="http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting" rel="noreferrer">JavaScript Scoping and Hoisting by Ben Cherry</a> in which he gives the following example: </p>
  
  <pre><code>var a = 1;
  
  function b() {
      a = 10;
      return;
  
      function a() {}
  }
  b();
  alert(a);
  </code></pre>
  
  <p>Using the code above, the browser will alert "1". </p>
  
  <p>I'm still unsure why it returns "1". Some of the things he says come to mind like: 
     All the function declarations are hoisted to the top. You can scope a variable using function.  Still doesn't click for me. </p>