Checks if value is a function.
Uses instanceof to test if the value is a Function. More reliable than typeof for all function types.
value to check
true if value is a function
isFunction(() => {}) // trueisFunction(function() {}) // trueisFunction(async () => {}) // trueisFunction(class MyClass {}) // trueisFunction('string') // falseisFunction({}) // false Copy
isFunction(() => {}) // trueisFunction(function() {}) // trueisFunction(async () => {}) // trueisFunction(class MyClass {}) // trueisFunction('string') // falseisFunction({}) // false
Checks if value is a function.
Uses instanceof to test if the value is a Function. More reliable than typeof for all function types.