10-while.html 480 B

1234567891011121314151617181920212223242526272829
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <script>
  8. // while
  9. var n = 10
  10. while (n > 0) {
  11. n = n - 2
  12. }
  13. console.log(n)
  14. // do while
  15. var n = 10
  16. do {
  17. n = n - 2
  18. } while (n > 0)
  19. console.log(n)
  20. </script>
  21. </head>
  22. <body>
  23. hi while
  24. </body>
  25. </html>