JavaScriptArrayevery

Tests whether all elements in the array pass the provided function.

Syntax

arr.every(callbackFn)

Example

Enter values below to update the example in real time.

const
numbers
allEven
every
console
const numbers = [2, 4, 6, 8];
const allEven = numbers.every((n) => n % 2 === 0);
console.log(allEven);   // true