# while Loop

Keeps repeating as long as its condition stays true.

## What is **while Loop** in JavaScript?

**while Loop** — Keeps repeating as long as its condition stays true.

```javascript
let attempts = 0;

while (attempts < 3) {
    attempts++;
}
```

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/apprentice)

Updated: September 27, 2026

## In other subjects

- [while Loop in C#](https://www.ask-codey.com/glossary/while-loop-c-sharp)
- [while Loop in Java](https://www.ask-codey.com/glossary/while-loop-java)

Source: https://www.ask-codey.com/glossary/while-loop-javascript
