Set the variable to different value and then try.
Result
Entering the loop
2
3
4
5
Exiting the loop!
Đặt biến vào giá trị khác nhau và thử thử .
We have seen the usage of the break statement within a switch statement .
The continue statement tells the interpreter to immediately start the next iteration of the loop and jump over the remaining code block. When a continue statement is encountered, the program flow moves immediately to the test expression and if the condition is true, then it starts the next iteration, otherwise the control exits the loop.
For example
This example illustrates the use of the continue statement with a while loop. Notice how the continue statement is used to jump over the print when the index is kept in the x value to 5.
You should read it
- For ... loop in JavaScript
- The while loop in JavaScript
- Syntax of JavaScript
- What is Currying in Javascript? How to use Currying in JavaScript
- What is JavaScript? Can the Internet exist without JavaScript?
- Switch Case command in JavaScript
- Things to know about 'this' in JavaScript
- Udemy's top 5 JavaScript courses
- Top site with many good JavaScript exercises to practice
- What is JavaScript?
- ! = and! == What is the difference in JavaScript?
- Learn about ES6 in Javascript