The break statement is a control flow statement used in JavaScript to exit a loop, switch statement, or labelled block. The break statement completely exits a while or for loop.
You can use the break statement in a loop to prematurely terminate the loop under certain conditions. For example, in a for loop, you can use the break statement to exit the loop when certain conditions are met.
The break statement can also be used with a label to exit nested loops.
Syntax:
break;
Example: