# Iterator.some()

> The `.some()` JS method of the `Iterator` object checks whether at least one value of an iterator passes a test.

## How do I check if any value of an iterator passes a test?

The method that returns `true` as soon as the callback returns a truthy value for any yielded value, stopping the iteration early. Returns `false` if no value passes the test.

- Topic: Iterator
- Type: method
- Browser support: Chrome 122+, Chrome Android 122+, Edge 122+, Firefox 131+, Firefox Android 131+, Safari 18.4+, Safari iOS 18.4+

## Example

Wrong:

```js
const hasAdmin = users.values()
  .filter((u) => u.role === 'admin')
  .toArray().length > 0;
```

Right:

```js
const hasAdmin = users.values()
  .some((u) => u.role === 'admin');
```

`some()` stops at the first admin and returns a boolean, instead of collecting every match into an array.

## Common mistakes

- Expecting the rest of the values to be available after `some()` returns `true`.

## Key points

- `some()` is used instead of `find()` when only a boolean is needed.
- The iterator is not reused after `some()`, because it stops at the first match.

## Interview questions

### What does iterator `some()` return for an empty iterator?

`false`, because no value passed the test.

### Is iterator `some()` the same as array `some()`?

It gives the same answer, but works on any iterator, reads values lazily and closes the iterator after the first match.

## Related cards

- [Iterator.every()](https://wonderium.dev/js/iterator-every.md)
- [Iterator.find()](https://wonderium.dev/js/iterator-find.md)
- [Array.some()](https://wonderium.dev/js/array-some.md)
- [Iterator](https://wonderium.dev/js/iterator.md)

---

- Level: [JavaScript](https://wonderium.dev/js.md)
- HTML version: https://wonderium.dev/js/iterator-some
- Last updated: 2026-11-25
