1
<p>点击下面的按钮来执行循环,该循环会跳过 i=3 的步进。</p>
2
<button onclick="myFunction()">点击这里</button>
3
<p id="demo"></p>
4
<script>
5
function myFunction() {
6
var x = "",
7
i = 0;
8
for (i = 0; i < 10; i++) {
9
if (i == 3) {
10
continue;
11
}
12
x = x + "该数字为 " + i + "<br>";
13
}
14
document.getElementById("demo").innerHTML = x;
15
}
16
</script>