JavaScript Iterator some() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Instance method

Definition

iterator.some(callback) walks each value and asks: does this one pass the test? If any value passes, the result is true right away. If every value fails, the result is false.

The method consumes the iterator. After a match (or after the end), the iterator is closed. An empty iterator returns false, because nothing passed the test.

Remember
iterator.some(callback)

one truthy callback  → true (stops early)
all falsy / empty    → false

Consumes the iterator (it is closed after the call).
Callback gets (value, index).
Opposite idea of every().

Syntax

Call it on an iterator and pass a function that returns true for a value you care about.

JavaScript
const nums = [1, 2, 3, 4, 5].values();

const hasBig = nums.some((n) => n > 4);
console.log(hasBig);   // true
CallWhat it does
iterator.some(callback)Return true if at least one value passes; otherwise false.
[1, 2, 3].values().some(fn)Get an iterator from an array, then test for any match.
[].values().some(fn)An empty iterator returns false.
callback(value, index)Your function receives the current value and its zero-based index.

A standard JavaScript method (Iterator helpers, Baseline 2025) on every iterator, from Iterator.prototype. No import required. Siblings: Iterator.concat(), Iterator.from(), Iterator.zip(), Iterator.zipKeyed(), chunks(), drop(), every(), filter(), find(), flatMap(), forEach(), includes(), join(), map(), reduce(), take(), toArray(), windows(), [Symbol.dispose](), [Symbol.iterator]().

Library declarations
JavaScript
// Iterator helpers (Baseline 2025)
Iterator.prototype.some(callbackFn)

// callbackFn : (value, index) => boolean-like
// returns    : true or false

Parameters

ParameterDescription
callbackFnRequired. A function called for each value until a match is found. Return a truthy value to succeed, or a falsy value to keep looking. It receives value and index (starting at 0).

Return Value

Return ValueDescription
booleantrue as soon as one value passes the test. false if the iterator ends with no match (including when it was empty). The iterator is closed either way.

JavaScript Examples

Example 1 — Check Whether Any Value Passes

Ask if any number from 1 through 5 is greater than 4.

JavaScript
const nums = [1, 2, 3, 4, 5].values();
const hasBig = nums.some((n) => n > 4);

console.log("Any > 4: " + hasBig);
Try It Yourself

The Try It page first checks that iterator.some() exists, because Iterator helpers are still new. In an older browser it prints a short explanation and the output above. In a current browser it runs the code for real.

How It Works

  1. Make an iterator. [1, 2, 3, 4, 5].values() yields each number.
  2. Test until a hit. 1–4 fail n > 4; 5 passes.
  3. Result is true. some() stops at the first success and closes the iterator.

Example 2 — See false When Nothing Passes

Search for an even number in a list of odd numbers.

JavaScript
const nums = [1, 3, 5].values();
const hasEven = nums.some((n) => n % 2 === 0);

console.log("Any even: " + hasEven);
Try It Yourself

The Try It page first checks that iterator.some() exists, because Iterator helpers are still new. In an older browser it prints a short explanation and the output above. In a current browser it runs the code for real.

How It Works

  1. Test each value. 1, 3, and 5 are all odd.
  2. No success. The callback never returns a truthy result.
  3. Result is false. When the iterator ends without a hit, some() returns false.

Example 3 — Use Value and Index Together

Return true when any value equals ten times its 1-based position.

JavaScript
const nums = [10, 25, 30].values();
const ok = nums.some((n, i) => n === (i + 1) * 10);

console.log("Any match: " + ok);
Try It Yourself

The Try It page first checks that iterator.some() exists, because Iterator helpers are still new. In an older browser it prints a short explanation and the output above. In a current browser it runs the code for real.

How It Works

  1. Two arguments. The callback receives n (value) and i (index from 0).
  2. First value matches. At index 0, 10 === 1 * 10 is true.
  3. Result is true. some() stops at that success and does not need the later values.

Browser & Runtime Support

Iterator.prototype.some() is an Iterator helper (Baseline Newly available since March 2025). It works in current browsers and in Node.js 22 or newer.

✓ Baseline 2025 · Newly available

iterator.some()

Supported in Chrome 122+, Edge 122+, Firefox 131+, Safari 18.4+, Opera 108+ and Node.js 22+. Internet Explorer never got it.

2025 Standard since
Google Chrome 122+ · Desktop & Mobile
Full support
Microsoft Edge 122+ · Chromium based
Full support
Mozilla Firefox 131+ · Desktop & Mobile
Full support
Apple Safari 18.4+ · macOS & iOS
Full support
Opera 108+ · Chromium based
Full support
Samsung Internet 26+ · Android
Supported
Android WebView 122+ · Chromium based
Supported
Node.js 22+ · Server runtime
Supported
Deno Recent versions · JavaScript runtime
Supported
Bun Recent versions · JavaScript runtime
Supported
Internet Explorer No native support
Not supported
iterator.some() Current browsers

Bottom line: Check support with a typeof test before you use it in older browsers. Prefer chaining helpers and calling toArray() last.

Frequently Asked Questions

It returns true if at least one value from the iterator passes your test function. If none pass, it returns false. The iterator is consumed.
some() needs one success. every() needs every value to succeed. An empty iterator makes some() false and every() true.
Yes. As soon as the callback returns a truthy value, some() returns true and closes the iterator. Remaining values are not read.
No. some() closes the iterator whether it found a match or not. Create a new iterator if you need another pass.
The idea matches Array.prototype.some(), but it runs on an iterator helper. Feature-detect support in older browsers before you rely on it.

Next: take()

Learn how to take only the first N values from an iterator and keep chaining helpers.

take() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful