When I was looking at the code at work, I found code like the one below while setting up a callback function.
if($.isFunction(callback)){
callback();
}
The above writing method is actually jQuery.
You can also write in JavaScript.To check whether the value passed in i a function, use stypeof.
function(callBack)
{
...
if(typeof callBack == 'function') {
callBack();
}
}
jQuery's $.isFunction … return boolean
typeof … returns a string of type
I think that it is good to check the type by the basic typeof.