JavaScript execution order - run this(), then that() when this() has finished?
<p>If for example, I have some jQuery doing something simple like:</p>

<pre><code>$("div").fadeIn('fast');
$("div").html('Foo');
</code></pre>

<p>That would fade in the div, and set its html to "Foo" whilst it's still fading in, whereas:</p>

<pre><code>$("div").fadeIn('fast',function(){
   $("div").html('Foo');
});
</code></pre>

<p>Will only set the html to "Foo" after the div has completed fading in.</p>

<p>Is this sort of thing the way JavaScript works in general? So if I had:</p>

<pre><code>//do something
var i = 42;
var foo = i/1;
//do something else
var bar = fooBar();
</code></pre>

<p>Will it start doing something else whilst it's still doing something, or will it wait patiently for do something to finish before it does something else?</p>
