About the Break Statement
The break statement causes execution within a switch, while, do/while, for, or for/in statement to terminate immediately.
See About the Switch Statement.
See About the While statement.
See About the Do/While Statement.
See About the For/In Statement.
Break has a very simple syntax:
The following example adds all numbers in list until it encounters the first negative value. When a negative value is encountered, the loop execution is terminated by break.
If you have nested loops, only the loop that immediately contains the break statement is terminated. For example, the break statement in the following code terminates only the innermost loop.