The do-while loop

The JavaScript do-while loop is similar to the while loop, the only difference is the do-while loop executes a statement at least once before checking the condition is true or false. 

Syntax

do {
   Statement's to be executed;
} while (expression);
Flow chart of do-while














Example
<html>
    <head>
        <title>JS do-while loop</title>
        
    </head>
    <body>
        <script>
            var n=1;
            document.write("--Start--"+"</br>");
            do{ 
            document.write(n+"</br>");
                n++;
        }
            while (n<=10);
            document.write("--End--");
        </script>
    </body>
</html>
Output