[JavaScript] JavaScript循环中continue的使用代码演示 →→→→→进入此内容的聊天室

来自 , 2019-06-27, 写在 JavaScript, 查看 120 次.
URL http://www.code666.cn/view/e9287a53
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p>Click the button to do a loop which will skip the step where i=3.</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. for (i=0;i<10;i++)
  14.   {
  15.   if (i==3)
  16.     {
  17.     continue;
  18.     }
  19.   x=x + "The number is " + i + "<br>";
  20.   }
  21. document.getElementById("demo").innerHTML=x;
  22. }
  23. </script>
  24.  
  25. </body>
  26. </html>
  27.  
  28.  
  29.  
  30. //javascript/7840

回复 "JavaScript循环中continue的使用代码演示"

这儿你可以回复上面这条便签

captcha