Home
<!DOCTYPE html> <html> <body> <h1>Demo: do while loop</h1> <p id="p0"></p> <p id="p1"></p> <p id="p2"></p> <p id="p3"></p> <p id="p4"></p> <script> var i =0; do{ document.getElementById("p" + i).innerHTML = i; i++; } while(i < 5) </script> </body> </html>
Result: