JavaScript继续声明 (JavaScript continue statement)
continue is a keyword in JavaScript, it is used with the looping statements to continue the loop's iteration.
continue是JavaScript中的关键字,它与循环语句一起使用以继续循环的迭代。
When a continue statement executes, it breakouts the current loop's iteration and continues to the next loop's iteration.
当执行continue语句时 ,它将中断当前循环的迭代,并继续进行下一个循环的迭代。
Syntax:
句法:
continue;
JavaScript中的continue语句示例 (Example of continue statement in JavaScript)
<html>
<head><title>JavaScipt Example</title></head>
<body>
<script>
var loop = 1;
//continues when value of loop is 7
for(loop=1; loop<=10; loop++){
if(loop==7)
continue;
document.write(loop + " ");
}
document.write("<br>");
document.write("Outside of the loop<br>");
</script>
</body>
</html>
Output
输出量
1 2 3 4 5 6 8 9 10
Outside of the loop
翻译自: https://www.includehelp.com/code-snippets/continue-statement-with-example-in-javascript.aspx