JavaScript FOR Loop Example

var LoopNumber = 5;
for (i=1;i<=LoopNumber;i++)
{
alert(i);
}
The preceding codes works as follows:
The loop variable (i) is initiated at a certain number – in this case 1.
A condition is set for when the loop should end – in this case it is when the loop variable has been incremented to a number greater than 5.
The loop variable is [...]