I see the "When is a function not a function" thread has flared up
again.
This is what I use to test parameters that can be Functions or
Objects. It does return the expected result for callable host objects
(at least the ones I tested.) None of the functions it supports are
expected to receive those as parameters. The second part of the test
is a little ambiguous in this regard (for browsers that do not support
call), so it is best to exclude callable host objects as a rule.
var isFunction = function(o) {
return typeof(o) == 'function' && (!Function.prot otype.call ||
typeof(o.call) == 'function');
};
again.
This is what I use to test parameters that can be Functions or
Objects. It does return the expected result for callable host objects
(at least the ones I tested.) None of the functions it supports are
expected to receive those as parameters. The second part of the test
is a little ambiguous in this regard (for browsers that do not support
call), so it is best to exclude callable host objects as a rule.
var isFunction = function(o) {
return typeof(o) == 'function' && (!Function.prot otype.call ||
typeof(o.call) == 'function');
};
Comment