Add isArray
This commit is contained in:
9
snippets/is-array.md
Normal file
9
snippets/is-array.md
Normal file
@ -0,0 +1,9 @@
|
||||
### Is array
|
||||
|
||||
Use `Array.isArray()` to check if a value is classified as an array.
|
||||
|
||||
```js
|
||||
const isArray = val => val && Array.isArray(val);
|
||||
// isArray(null) -> false
|
||||
// isArray([1]) -> true
|
||||
```
|
||||
Reference in New Issue
Block a user