Javascript Reference
Categories: Operators

javascript Operators do/while

@March 15, 2008, 1:22 a.m.
do/while Firefox/Netscape/NN 4 IE 4 ECMA 3  

  

Executes statements in a loop while a condition is true. Because the condition is tested at the end of the loop, the statements inside it are always executed at least one time. It is imperative that the expression that makes up the condition have some aspect of its value potentially altered in the statements. Otherwise, an infinite loop occurs.

 
Example
 
var i = 1;
do {
    window.status = "Loop number " + i++;
} while (i <= 10)
window.status = "";

Powered by Linode.