[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/some [Back]  [Original]

TypedArray.prototype.some() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

TypedArray.prototype.some()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2016 9.

some() . Array.prototype.some() . TypedArray TypedArray .

In this article

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

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

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

console.log(positives.some(isNegative));
// Expected output: false

js
typedarray.some(callback[, thisArg])

callback

, :_ currentValue _ : .

index

.

array

some .

thisArg

. callback this .

some callback true callback . , some true . , some false .

callback : , (traverse) .

thisArg some , callback , this . , undefined this . callback this this .

some (mutate) .

10 .

js
function isBiggerThan10(element, index, array) {
  return element > 10;
}
new Uint8Array([2, 5, 8, 1, 4]).some(isBiggerThan10); // false
new Uint8Array([12, 5, 8, 1, 4]).some(isBiggerThan10); // true

.

js
new Uint8Array([2, 5, 8, 1, 4]).some((elem) => elem > 10); // false
new Uint8Array([12, 5, 8, 1, 4]).some((elem) => elem > 10); // true

Specification
ECMAScript 2027 LanguageSpecification
# sec-%typedarray%.prototype.some


Web Proxy Viewer  |  New URL  |  Original Page