Code demonstration of do while loop statement in JavaScript

From , 3 Years ago, written in JavaScript, viewed 146 times.
URL https://pastebin.vip/view/8c514936
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p>Click the button to loop through a block of as long as <em>i</em> is less than 5.</p>
  6. <button onclick="myFunction()">Try it</button>
  7. <p id="demo"></p>
  8.  
  9. <script>
  10. function myFunction()
  11. {
  12. var x="",i=0;
  13. do
  14.   {
  15.   x=x + "The number is " + i + "<br>";
  16.   i++;
  17.   }
  18. while (i<5)  
  19. document.getElementById("demo").innerHTML=x;
  20. }
  21. </script>
  22.  
  23. </body>
  24. </html>
  25.  
  26.  
  27. //javascript/7838

Reply to "Code demonstration of do while loop statement in JavaScript"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website