Home > Web Front-end > JS Tutorial > How to use Break and Continue in JavaScript programs

How to use Break and Continue in JavaScript programs

高洛峰
Release: 2016-11-28 13:54:51
Original
1274 people have browsed it

This is about js tutorial-JavaScript Break and Continue usage. There are two statements that can be used in loops: break and continue.

JavaScript break and continue statements

There are two special statements that can be used inside loops: break and continue. The

Break

break command can terminate the execution of the loop and then continue executing the code after the loop (if there is code after the loop).

Example:





Result:
The number is 0
The number is 1
The number is 2
Continue

The continue command will terminate the current loop and continue from the next value.

Example:





Results:
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

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template