---
url: /docs/guide/usage/linter/rules/eslint/no-unreachable-loop.md
---

### What it does

Disallow loops whose body allows only one iteration.

### Why is this bad?

A loop that always exits before a second iteration is usually accidental
and can be replaced with simpler control flow.

### Examples

Examples of **incorrect** code for this rule:

```js
for (const item of items) {
  console.log(item);
  break;
}
```

Examples of **correct** code for this rule:

```js
for (const item of items) {
  console.log(item);
}
```

## Configuration

### ignore

type: `array`

#### ignore\[n]

type: `"WhileStatement" | "DoWhileStatement" | "ForStatement" | "ForInStatement" | "ForOfStatement"`

## How to use

## Version

This rule was added in v1.79.0.

## References
