Javascipt scoping and hoisting: code returns 1 instead of 10 as expected
<p>I am kind of novice in JavaScript, I really don't quite understand why the below code return <code>1</code> instead of <code>10</code>:</p>

<pre><code>var a = 1;
function b() {
    a = 10;
    return;
    function a() {}
}
b();
alert(a);
</code></pre>

<p>The running code: <a href="http://jsfiddle.net/smMtU/" rel="nofollow">http://jsfiddle.net/smMtU/</a></p>

<p>If I rem the line <code>function a() {}</code>, it returns <code>10</code> as expected. This code got from <a href="http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html" rel="nofollow">this post</a> to explain the concept <em>scoping and hoisting</em> in JavaScript. Maybe I am missing something while reading this post? </p>

<p>Please anyone could point out the concept behind this code?</p>
