Using Array#every and Array#some to test array values

Sometimes, we need to know information about the array as a whole rather than individual elements, such as "Are there any elements that meet some criterion?" or "Do all the elements meet some criterion?".

In this recipe, we'll take a look at how to use the some and every methods to test an array.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.