# Iterator.every()

> The `.every()` JS method of the `Iterator` object checks whether all values of an iterator pass a test.

## How do I check if all values of an iterator pass a test?

The method that returns `false` as soon as the callback returns a falsy value for any yielded value, stopping the iteration early. Returns `true` if all values pass 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 allPaid = Array.from(orders.values())
  .every((order) => order.paid);
```

Right:

```js
const allPaid = orders.values()
  .every((order) => order.paid);
```

`every()` runs on the iterator directly and stops at the first unpaid order, without copying all orders into an array.

## Common mistakes

- Expecting `every()` to read the whole iterator when it returns `false` at the first failure.

## Key points

- The callback receives the value and a counter, not the source array.
- The iterator is not reused after `every()`, because it may stop early and close it.

## Interview questions

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

`true`, because no value fails the test.

### What is the difference between `every()` and `some()` on an iterator?

`every()` stops at the first falsy result and returns `false`. `some()` stops at the first truthy result and returns `true`.

## Related cards

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

---

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