Files
30-seconds-of-code/snippets/all.md
2018-02-14 11:46:15 +02:00

252 B

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.

const all = arr => arr.every(Boolean);
all([1,2,3]); // true