Javascript For Loop
The for loop accepts three arguments initialization, truth expression and increment expression.
Syntax of For Loop
for(initialization; truth expression; increment expression){
statements;
}
The initialization evaluates only once, it initializes the variable. After that, truth expression is evaluated. The truth expression evaluates in every iteration of the loop and the increment expression is evaluated at the end of every iteration.
Example
In the given example, the loop starts at i equals to '0' and executes until the value of i is less than 5.
<script>
for(var i = 0; i < 5; i++){
document.write("Number : " + i + "<br/>");
}
</script>