Since I have been reading javascript recently, I will briefly introduce some usage of the three of them in javascript.
Break statement:
The break statement causes the running program to immediately exit the loop contained in the innermost layer or exit a switch statement. Because it is used to exit a loop or switch statement, this form of break statement is valid only when it appears in these statements.
If the termination condition of a loop is very complex, it is much easier to use the break statement to implement certain conditions than to use a loop expression to express all the conditions.
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Continue statement:
The continue statement is similar to the break statement. The difference is that it is not to exit a loop, but to start a new iteration of the loop.
The continue statement can only be used in the loop body of the while statement, do/while statement, for statement, or for/in statement. It may cause errors when used elsewhere!
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Return Statement:
The return statement is used to specify the value returned by the function. The return statement can only appear in the function body. syntax errors may occur anywhere else in the code!
When a return statement is executed, function execution stops even if there are other statements in the function body!