jQuery 1.4.2 in IE 8
When I call $.isFunction(function() {}) it returns true.
Source code isFunction function:
isFunction: function (obj) {
return toString.call(obj) === "[object Function]";
},
When I write in console toString.call(function() {}) === "[object Function]" it throws "Object doesn't support this property or method".
Source code of minified version:
isFunction:function(a){return $.call(a)==="[object Function]"}
When I write in console $.call(function() {})==="[object Function]" it returns false.
Why code works in different ways?
At the top of the JQuery 1.4.2 source (inside the wrapper),
toStringis defined asObject.prototype.toString. The globaltoStringfunction is different from the prototypedtoStringmethod, hencethe different results.