# while Loop

*noun*

say it: **“WILE loop”** **/waɪl luːp/**

A loop that keeps running its block as long as its condition stays true, checking the condition before each pass.

## 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++;
}
```

## In a sentence

- “The **while loop** keeps rolling the dice until it lands on 6.”

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=2)

Updated: November 9, 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)
- [while Loop in PowerShell](https://www.ask-codey.com/glossary/while-loop-powershell)
- [while Loop in Python](https://www.ask-codey.com/glossary/while-loop)
- [while Loop in Unix](https://www.ask-codey.com/glossary/while-loop-unix)

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