Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

while

The while statement is a loop mechanism that will execute code as long as the while condition returns a value of 'true'. It stops running when the condition returns 'false'.

Syntaxwhile ( true ) { ... }
var i = 0; while (i < 5){ i++; document.write("Pass "+i+" of the loop<br>"); }

JavaScript

Statements

breakconstcontinuedo whileforfor inif elselabelreturnswitchtry catchvarwhilewith