for
Loops a specific number of times.
Syntax
for (let i = 0; i < n; i++) { ... }Description
Three parts: initialization, condition, increment. Repeats a specific number of times using the i counter.
Example
Loading editor…
Expected output
1 2 3
When to use?
Indexed loop, specific repetition.