Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
Reference / JavaScript

Array.prototype.every()

Tests whether all elements in the array pass the test implemented by the provided function.

Syntax
every(predicate: (value: T, index: number, array: T[]) => boolean): boolean

Parameters

NameTypeDescription
predicateFunctionCondition tester function.

Examples

Check if all numbers are positive
const numbers = [10, 20, 30];
console.log(numbers.every(n => n > 0)); // true
Returns true for any condition on an empty array (vacuous truth).