Update is.md
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Checks if the provided value is of the specified type.
|
Checks if the provided value is of the specified type.
|
||||||
|
|
||||||
Ensure the value is not `undefined` or `null` and compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
|
Ensure the value is not `undefined` or `null` using `Array.includes()`, and compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const is = (type, val) => ![, null].includes(val) && val.constructor === type;
|
const is = (type, val) => ![, null].includes(val) && val.constructor === type;
|
||||||
|
|||||||
Reference in New Issue
Block a user