while loop in JavaScript:
The while loop iterates through a block of code until specified condition gets false. Here is example of while loop in JavaScript as bellow:
//Syntax: while (condition) { code block to be executed } //Example: var x=0,i=0; while(i<=5) { x=x + i; i++; } alert(x);