I just played around a bit with the animate() method.
.animate( properties [, duration] [, easing] [, complete] )
I know that I dont have to pass all the arguments to a function in javascript. But what I would like to know is how jquery figures out that function(){ } refers to the callback function, which is actually the 4:th parameter, instead of the easing string (which is the 3:rd)?
$('div').animate({ height: '10px' }, 100, function(){ });
There are simply tests to check the type :
From the source code (
animatecallsspeed) :So basically it checks that
Object.prototype.toString.call(fn)is"[object Function]".