Loops
Use loops to execute a block of code to run multiple times.
In JavaScript there are two different kind of loops:
The for loop:
for ( variable = startvalue; variable <= endvalue; variable = variable + increment )
{
code to be executed...;
more code to be executed...;
}
The while loop:
Use the while loop when you want your code to continue executing as long as the specified condition is true.
syntax
while (variable <= end_value)
{
code to be executed;
more code to be executed;
}
The do while loop:
Use the do while loop to run the same block of code while a specified condition is true. This loop will always be executed at least once.
=================do { code to be executed } while (var<=endvalue)=================
function
dowhileloop3()
{
var i=0
do
{
alert(i)
i=i+1
}
while (i<1)
}