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 result = '';
2var i = 0;
3do {
4 i += 1;
5 result += i + ' ';
6}
7while (i > 0 && i < 5);
8// Despite i == 0 this will still loop as it starts off without the test
9
10console.log(result);