Files
30-seconds-of-code/snippets/isFunction.md
2018-01-04 08:12:04 +11:00

289 B

isFunction

Checks if the given argument is a function.

Use typeof to check if a value is classified as a function primitive.

const isFunction = val => typeof val === 'function';
isFunction(null); // false
isFunction('x'); // false
isFunction(x => x); // true