Javascript: While Loop

The while loop is probably Javascript's most simple loop.

var myValue = 0;

while(myValue < 10){
  document.write("My value is: " + myValue);
  myValue++; //increment myValue by 1

While the condition myValue is less than 10 is true the statement in between the two curly braces will contiune to be evaluated. As soon as the conditional statement at the beginning resolves to false those statments in the curly braces are no longer executed.