Update isFunction.md

This commit is contained in:
atomiks
2018-01-04 08:12:04 +11:00
committed by GitHub
parent 3fc20d131b
commit ead337acd9

View File

@ -5,10 +5,11 @@ Checks if the given argument is a function.
Use `typeof` to check if a value is classified as a function primitive. Use `typeof` to check if a value is classified as a function primitive.
```js ```js
const isFunction = val => val && typeof val === 'function'; const isFunction = val => typeof val === 'function';
``` ```
```js ```js
isFunction(null); // false
isFunction('x'); // false isFunction('x'); // false
isFunction(x => x); // true isFunction(x => x); // true
``` ```