Update isFunction.md
This commit is contained in:
@ -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
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user