[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/every [Back]  [Original]

TypedArray.prototype.every() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

TypedArray.prototype.every()

20169

TypedArray every() Array.prototype.every()

function isNegative(element, index, array) {
  return element < 0;
}

const int8 = new Int8Array([-10, -20, -30, -40, -50]);

console.log(int8.every(isNegative));
// Expected output: true

js
every(callbackFn)
every(callbackFn, thisArg)

callback

element

index

array

every()

thisArg

callbackFn this

true callbackFn false

Array.prototype.every()

10

js
function isBigEnough(element, index, array) {
  return element >= 10;
}
new Uint8Array([12, 5, 8, 130, 44]).every(isBigEnough); // false
new Uint8Array([12, 54, 18, 130, 44]).every(isBigEnough); // true

ECMAScript 2027 LanguageSpecification
# sec-%typedarray%.prototype.every


Web Proxy Viewer  |  New URL  |  Original Page