do while loop javascript

The Javascript do while loop will run all the statements within the do while code block until the condition of the do while loop has been met. Here is an example of which the do while loop will run six times and shows the alert box six times before the loop terminates.

var i = 0;
do {
	alert("Hello World!");
}while(i <= 5)

No matter what the above loop will at least run one time before it terminates. If you need to check the condition before the loop starts then I would suggest using the while loop or the for loop instead.