Update isArrayLike.md

This commit is contained in:
Angelos Chalaris
2018-01-01 17:12:38 +02:00
committed by GitHub
parent 2e3e5b2d1a
commit bc1b54f9c0

View File

@ -5,11 +5,7 @@ Checks if the provided argument is array-like (i.e. is iterable).
Use the spread operator (`...`) to check if the provided argument is iterable inside a `try... catch` block and the comma operator (`,`) to return the appropriate value.
```js
const isArrayLike = val =>
const isArrayLike = val => {
try {return [...val], true; }
catch (e) { return false; }
};