jQuery.isFunction(value) (alias $.isFunction) returns true when value is callable as a function (since jQuery 1.2). Use it to guard optional callbacks before calling them.
Function literal.function () {} is callable → true.
String."text" is not a function → false.
Boolean result. Easy to use in if before invoking.
Official pattern. Matches the jQuery API demo.
Example 2 — Guard an Optional Callback
Call done only when it is a function.
jQuery
function finish(result, done) {
if ($.isFunction(done)) {
done(result);
}
}
finish("ok", function (msg) {
console.log(msg); // "ok"
});
finish("ok", null); // no call, no error
Takeaway. Having .length does not make something a function.
Edge Cases & Pitfalls
Check these before calling unknown values.
deprecated
Removed in jQuery 4.0
Do not add new $.isFunction calls. Migrate to typeof x === "function" before leaving jQuery 3.x.
host
Old IE host methods
As of jQuery 1.3, browser host functions like alert were not guaranteed to detect as functions in old IE. Modern browsers are fine with typeof.
collection
$els is not callable
A jQuery collection is an object. Test the callback parameter, not the selection you built with $().
classes
Classes are functions
class Foo {} is a constructor function — typeof Foo === "function" is true. That is expected.
Compatibility
Browser Support
jQuery.isFunction() is available from jQuery 1.2+ through jQuery 3.x. It is deprecated since 3.3 and removed in 4.0. Prefer typeof x === "function" in all modern browsers.
✓ Deprecated · jQuery 3.x
jQuery.isFunction()
Works in browsers with jQuery 1.2–3.x. For new code use typeof x === "function". Not available in jQuery 4.0.
LegacyjQuery 3.x only
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
$.isFunction()Legacy
Bottom line: Read $.isFunction in legacy jQuery 3.x apps. Write typeof x === "function" for everything new.
Analysis
Performance Notes
Approach
Cost
Best for
typeof x === "function"
O(1)
All new code
$.isFunction(x)
O(1)
Legacy jQuery 3.x only
$.type(x) === "function"
Slightly heavier
Multi-type branching
Function checks are cheap. Prefer native typeof for clarity and to avoid a removed jQuery API — not for micro-speed gains.
Remember
Key Takeaways
Role:$.isFunction(x) → true if callable.
Migrate: use typeof x === "function".
Guard: check before calling optional callbacks.
Note:$ is a function; $() is not.
One line: use $.isFunction to learn legacy callback guards — write typeof x === "function" going forward.
Frequently Asked Questions
jQuery.isFunction(value) returns true when value is callable as a function, and false otherwise. The official example is $.isFunction(function () {}) → true.
Yes. It was deprecated in jQuery 3.3 and removed in jQuery 4.0. Prefer typeof x === "function" in all new code.
For normal functions they agree. The jQuery docs recommend replacing most $.isFunction(x) checks with typeof x === "function".
Yes. Arrow functions, async functions, generators, and classic function declarations/expressions are all functions — they return true.
No. $("div") is an object collection → false. The jQuery factory $ itself is a function → true.
jQuery.type(value) returns the string "function" for functions. jQuery.isFunction(value) returns true for those same values. Prefer a boolean check before calling a callback.
Yes, if an older jQuery that still includes isFunction is loaded. Prefer typeof x === "function" everywhere — it is native and does not need jQuery.