Skip to content

for loop

The for loop repeats a block of code until a specified condition becomes false. It consists of three optional parts: initialization, condition, and final expression (often used for counters).

for (let i = 0; i < 5; i++) {
console.log("Itération " + i);
}
// Affiche : Itération 0, Itération 1, ..., Itération 4