for

for is a loop that executes when the condition is true.

It is similar to a while loop but has different syntax.

Syntax

for (variable; condition; increment) {
  code
}

Example

External

Mozilla Developer Network