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

259 B

any

Returns true if at least one element in a collection is truthy, false otherwise.

Use Array.some(Boolean) to test if any elements in the collection are truthy.

const any = arr => arr.some(Boolean);
any([0,0,1,0]); // true