Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The every() method of Array instances returns false if it finds an element in the array that does not satisfy the provided testing function. Otherwise, it returns true.
A function to execute for each element in the array. It should return a truthy value to indicate the element passes the test, and a falsy value otherwise. The function is called with the following arguments:
elementThe current element being processed in the array.
indexThe index of the current element being processed in the array.
arrayThe array every() was called upon.
thisArg OptionalA value to use as this when executing callbackFn. See iterative methods.
true unless callbackFn returns a falsy value for an array element, in which case false is immediately returned.
The every() method is an iterative method. It calls a provided callbackFn function once for each element in an array, until the callbackFn returns a falsy value. If such an element is found, every() immediately returns false and stops iterating through the array. Otherwise, if callbackFn returns a truthy value for all elements, every() returns true. Read the iterative methods section for more information about how these methods work in general.
every acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returns true. (It is vacuously true that all elements of the empty set satisfy any given condition.)
callbackFn is invoked only for array indexes which have assigned values. It is not invoked for empty slots in sparse arrays.
The every() method is generic. It only expects the this value to have a length property and integer-keyed properties.
The following example tests whether all elements in the array are 10 or bigger.
The following example tests if all the elements of an array are present in another array.
The array argument is useful if you want to access another element in the array. The following example first uses filter() to extract the positive values and then uses every() to check whether the array is strictly increasing.
every() will not run its predicate on empty slots.
The every() method reads the length property of this and then accesses each property with a nonnegative integer key less than length until they all have been accessed or callbackFn returns false.
| ECMAScript® 2027 Language Specification # sec-array.prototype.every |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Feb 24, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.