1var i=0;
2while (i < 10) {
3 console.log(i);
4 i++;
5}
6//Alternatively, You could break out of a loop like so:
7var i=0;
8while(true){
9 i++;
10 if(i===3){
11 break;
12 }
13}
1var i = 1; // initialize
2while (i < 100) { // enters the cycle if statement is true
3i *= 2; // increment to avoid infinite loop
4document.write(i + ", "); // output
5}