JavaScript » Statements » label

Syntax:
label: statements

A label can be used to identify a statement allowing you to refer to it elsewhere in a program.

It can be used with the break or continue statements (examples of which can be seen in the relevent pages) to modify the execution of a loop. It can also be used with other statements as in the following example which tests for an even number, and displays it, unless it's a 12.

Examples

Code:
even_number:
if(i%2==0)
{
   if(i==12)
      break even_number;
   document.write(i);
}