Creating Do While Loop
There is one more loop that you don't see very often but you will run to it for time to time. It's called Do While Loop. The difference between this loop and the classic While loop is we move the condition to the end of the block.
var a = 0;
do {
alert(a);
a++;
} while (a<10);
The format look a little weird because it's different than what we see before but it still have the same element. You set up the index, do something, and check the condition. The main different is this loop will execute your code once before checking the condition. So code above will printing variable 'a' first, then check if condition still met.