Files
30-seconds-of-code/snippets/all.md
30secondsofcode b4b0909a1d Travis build: 1674
2018-02-14 11:32:14 +00:00

14 lines
254 B
Markdown

### all
Returns `true` if all elements in a collection are truthy, `false` otherwise.
Use `Array.every(Boolean)` to test if all elements in the collection are truthy.
```js
const all = arr => arr.every(Boolean);
```
```js
all([1, 2, 3]); // true
```