Prev Demo
JavaScript
>
How To Write Do While Loop In Javascript?
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Do While Loop</h1> <script> function TestFunction() { var i = 0; do { alert(i); i++; } while (i < 5); } </script> <input type="button" id="btnTest" onclick="TestFunction()" value="Click me" /> </body> </html>
Note: We DO NOT save your trial code in our database.
Output