label Statements

label statements refer to statements in other locations. For example, you can use label to identify a loop and then use break to interrupt execution of the loop.

label statement syntax:

label : 
  statement

label can be any JavaScript identifier that is not a reserved word, and the statement identified by label can be any type.

Example—markLoop (the label identifier) identifies a while loop:

markLoop:
while (theMark == true){

  doSomething();
}