continue loopcontinue
Continue loop continue
Statement structure:
for(初始条件;判断条件;循环后条件值更新)
{
if(特殊情况)
{ continue; }
循环代码
}In the above loop, when a special situation occurs, this loop will is skipped, and subsequent loops will not be affected. It's like outputting 10 numbers. If the number is 5, it won't be output.
<html>
<head>
<script>
var num;
for(num=1;num<10;num++){
if (num==5)
{
continue;//如果num是5,退出循环。
}
document.write("数值"+num+"<br />");
}
</script>
</head>
<body>
</body>
</html>The results are as follows:

In the above code, the loop with num=5 will be skipped.
<!DOCTYPE html>
<html>
<body>
<p>点击下面的按钮来执行循环,该循环会跳过 i=3 的步进。</p>
<button onclick="myFunction()">点击这里</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x="",i=0;
for (i=0;i<10;i++)
{
if (i==3)
{
continue;
}
x=x + "The number is " + i + "<br>";
}
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
new file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>continue</title>
<script type="text/JavaScript">
var mynum =new Array(70,80,66,90,50,100,89);//定义数组mynum并赋值
var i;
for(i=0;i<mynum.length;i++)
{
if(mynum[i]<60)
{
document.write("成绩不及格,不输出!"+"<br>");
continue;
}
document.write("成绩:"+mynum[i]+"及格,输出!"+"<br>");
}
</script>
</head>
<body>
</body>
</html>
Preview
Clear
- Course Recommendations
- Courseware download
The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~
Students who have watched this course are also learning
Let's briefly talk about starting a business in PHP
Quick introduction to web front-end development
Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
Login verification and classic message board
Computer network knowledge collection
Quick Start Node.JS Full Version
The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)
















