Animation + none asynchronous behavior

Animation + none asynchronous behavior

JavaScript has never provided threaded/asynchronous behaviour.
By that i mean you cannot have two functions running at the same time or directly take advantage of mult-core CPUs
The only exception is webworkers

however if you have the following code

$('#div').animate({top:1000px},10000);
console.log('hi')

Although the animation is 10 seconds long, far longer than it takes a console.log to run, you would expect to see hi appear in the console long before the animation finished.

This shows that the console.log runs while the previous line of code is still being executed.

How does Javascript do this?