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

16 lines
289 B
Markdown

### isFunction
Checks if the given argument is a function.
Use `typeof` to check if a value is classified as a function primitive.
```js
const isFunction = val => typeof val === 'function';
```
```js
isFunction(null); // false
isFunction('x'); // false
isFunction(x => x); // true
```