The do...while loop is similar to the while loop except that the condition check happens at the end of the loop. This means that the loop will always execute at least once, even if the condition is false.
Syntax
The syntax for do-while loop in JavaScript is as follows,
do{ Statement(s) to be executed; } while(expression);
Example
Try the following example to learn how to implement a do-while loop in JavaScript,
<html> <body> <script> var count = 0; document.write("Starting Loop" + "<br />"); do{ document.write("Current Count : " + count + "<br/>"); count++; } while(count < 5); document.write ("Loop stopped!"); </script> </body> </html>