There are two types of statements that can be used in a loop: break and continue.
JavaScript break and continue Declaration
There are two special declarations available in the loop: break and continue.
Break
The break command can terminate the running of the loop and then continue executing the code after the loop (if there is code after the loop ).
Instance:
<Html> <body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Result:
The number is 0
The number is 1
The number is 2 Continue
The continue command terminates the current loop and continues running from the next value.
Instance:
<Html> <body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Result:
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