JavaScript Iterator some()
Example
Check if any values are over 7:
return value > 7;
}
const myIterator = Iterator.from("123456789");
let result = myIterator.some(checkValue);
Description
The some()
method checks if any element pass a test provided by a callback function.
The some()
method executes the callback function once for each element.
The some()
method returns true
(and stops)
if the function returns true
for one of the array elements.
The some()
method returns false
if the function returns false
for all of the array elements.
The some()
method does not execute the function for empty elements.
The some()
method does not change the original iterator.
Syntax
Parameters
A function to run for each element.
The value of the current element.
The index of the current element.
The iterator the current element belongs to.
undefined
.A value passed to the function to be used as its "this" value.
Return Value
true
if any element pass the test, otherwise false
.
Browser Support
iterator.some()()
is a JavaScript 2025 feature.
ES 2025 is fully supported in all modern browsers since May 2025:
Chrome 136 |
Edge 136 |
Firefox 129 |
Safari 18.2 |
Opera 120 |
Apr 2025 | Apr 2025 | Aug 2024 | Des 2024 | May 2025 |