JavaScript break 和 continue 語句
有兩種特殊的語句可用在循環內部
Break
break命令可以終止循環的運行
實例
<html>
<body>
<script type=
var i=
for (i=
{
if (i==
document
document
}
</script>
</body>
</html>
結果
The number is
The number is
The number is
Continue
continue命令會終止當前的循環
實例
<html>
<body>
<script type=
var i=
for (i=
{
if (i==
document
document
}
</script>
</body>
</html>
結果:
The number is 0
The number is 1
The number is 2
The number is 4
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9
The number is 10
From:http://tw.wingwit.com/Article/program/c/201404/30454.html