编辑下面的代码:【加编码】
<html> <body> <p>点击按钮执行循环,在 i 等于 3 时跳过当前循环。</p> <button onclick="myFunction()">点我</button> <p id="demo"></p> <script> function myFunction() { var text = ""; var i; for (i = 0; i < 5; i++) { if (i == 3) { continue; } text += "The number is " + i + "<br>"; } document.getElementById("demo").innerHTML = text; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂