while loop executes statements specified number of times, till the condition become false.
It is similar to for loop, except initialization is done outside of while loop. It is an Entry control loop.

Syntax

initialization;  // outside of loop

while(condition){
   // set of statements
  iteration;
}

Example

let i = 0;

while(i < 10){
  document.write(i);
   i++;
}

In above example, while loop outputs number from 0 – 9.