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

254 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