TypedArray.prototype.some()
Baseline Widely availableThis feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
>The some() method of TypedArray instances returns true if it finds an element in the array that satisfies the provided testing function. Otherwise, it returns false. This method has the same algorithm as Array.prototype.some().
Try it
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
Syntax
jssome(callbackFn)
some(callbackFn, thisArg)
Parameters
callbackFn-
A function to execute for each element in the typed 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:
thisArgOptional-
A value to use as
thiswhen executingcallbackFn. See iterative methods.
Return value
false unless callbackFn returns a truthy value for a typed array element, in which case true is immediately returned.
Description
See Array.prototype.some() for more details. This method is not generic and can only be called on typed array instances.
Examples
>Testing size of all typed array elements
The following example tests whether any element in the typed array is bigger than 10.
jsfunction 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
Specifications
| Specification |
|---|
| ECMAScript® 2027 Language Specification > # sec-%typedarray%.prototype.some > |
Browser compatibility
See also
- Polyfill of
TypedArray.prototype.someincore-js - JavaScript typed arrays guide
TypedArrayTypedArray.prototype.every()TypedArray.prototype.forEach()TypedArray.prototype.find()TypedArray.prototype.includes()Array.prototype.some()
Help improve MDN
Was this page helpful to you? Yes No Learn how to contributeThis page was last modified on Oct 26, 2026 by MDN contributors.
View this page on GitHub • Report a problem with this content