Will every single line of JavaScript need to be interpreted before the first line is executed?
<p>I tend to think of JavaScript like Ruby, that the first line is interpreted and executed, and the last line won't be interpreted until the very end.</p>

<p>But since JavaScript is subject to the hoisting rule, such as:</p>

<pre><code>console.log(foo);   // foo already has a value

function foo() {
    return 123;
}
</code></pre>

<p>so what if the <code>console.log</code> is the first line of the JavaScript file linked from the HTML, and the file is 200kb, and then the HTML file links 10 other JavaScript files, and the <code>foo</code> is defined at the last line of the last file, then since by the hoisting rule, the <code>foo</code> needs to be defined even at the first line, so that means all 11 files have to be downloaded <strong><em>and interpreted</em></strong> before even the first line can get executed?</p>
