| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/every | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..
every() , , .
:
true .
arr.every(callback(currentValue[, index[, array]])[, thisArg])
callback, :
currentValue.
index.
array, .
thisArg . , this callback.
true truthy . , false.
every() callback , , , callback (, false Boolean). , every() false. , callback true , every() true. callback , ; , .
callback : , , .
every() thisArg, callback this. this undefined. , this, callback, this, .
every() , .
, every(), callback. , every(), callback. , , callback, , every() ; .
every() . , true . (vacuously true) (.) .
, , 10.
function isBigEnough(element, index, array) {
return element >= 10;
}
[12, 5, 8, 130, 44].every(isBigEnough); // false
[12, 54, 18, 130, 44].every(isBigEnough); // true
[12, 5, 8, 130, 44].every((elem) => elem >= 10); // false
[12, 54, 18, 130, 44].every((elem) => elem >= 10); // true
every() ECMA-262 5- ; . , , every() , . , ECMA-262 5- ; Object TypeError callback.call Function.prototype.call().
if (!Array.prototype.every) {
Array.prototype.every = function (callbackfn, thisArg) {
"use strict";
var T, k;
if (this == null) {
throw new TypeError("this is null or not defined");
}
// 1. O ToObject
// this, .
var O = Object(this);
// 2. lenValue Get
// O "length".
// 3. len ToUint32(lenValue).
var len = O.length >>> 0;
// 4. IsCallable(callbackfn) false, TypeError.
if (typeof callbackfn !== "function") {
throw new TypeError();
}
// 5. thisArg , T thisArg; T undefined.
if (arguments.length > 1) {
T = thisArg;
}
// 6. k 0.
k = 0;
// 7. k < len,
while (k < len) {
var kValue;
// a. Pk ToString(k).
// in
// b. kPresent
// HasProperty O Pk.
// c
// c. kPresent true,
if (k in O) {
// i. kValue Get
// O Pk.
kValue = O[k];
// ii. testResult Call
// callbackfn T this ,
// kValue, k O.
var testResult = callbackfn.call(T, kValue, k, O);
// iii. ToBoolean(testResult) false, false.
if (!testResult) {
return false;
}
}
k++;
}
return true;
};
}
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-array.prototype.every |
Array.prototype.forEach()Array.prototype.some()Array.prototype.find()TypedArray.prototype.every()This page was last modified on 29 . 2026 . by MDN contributors.
ArrayArray.prototype.at()Array.prototype.concat()Array.prototype.copyWithin()Array.prototype.entries()Array.prototype.every()Array.prototype.fill()Array.prototype.filter()Array.prototype.find()Array.prototype.findIndex()findLast()findLastIndex()Array.prototype.flat()Array.prototype.flatMap()Array.prototype.forEach()Array.prototype.includes()Array.prototype.indexOf()Array.prototype.join()Array.prototype.keys()Array.prototype.lastIndexOf()Array.prototype.map()Array.prototype.pop()Array.prototype.push()Array.prototype.reduce()Array.prototype.reduceRight()Array.prototype.reverse()Array.prototype.shift()Array.prototype.slice()Array.prototype.some()Array.prototype.sort()Array.prototype.splice()Array.prototype.toLocaleString()Array.prototype.toReversed()Array.prototype.toSorted()toSpliced()Array.prototype.toString()Array.prototype.unshift()Array.prototype.values()Array.prototype.with()Array.prototype[@@iterator]()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |