Prev Demo
Returning 6 Lines Of Output By Using Do While Loop In Javascript.
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>6 lines of output by using Do While loop.</h1> <p>Click the button to show the result.</p> <input type="button" value="Button" onclick="myLoop()"/> <p id="myId"></p> <script> function myLoop() { var text = ""; var i = 0; do { text += "<br> This is " + i; i++; } while (i < 6); document.getElementById("myId").innerHTML = text; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output