for

The for loop executes a block of code a specified number of times.

Syntax

          for (initialization; condition; increment) {
   // statements
} 

        

Example

          for (var i = 0; i < 5; i++) {
    x = x + "The number is " + i;
}