The label keyword provides an identifier that can be used with break or continue.
You can associate a block of JavaScript statements with a label.
When a label is called using break or continue, code is executed.
<html> <body> <script language="JavaScript"> <!-- myLabelA: var x = 2+2; var y = 5*5; document.write("The value of 2+2 is: " + x + "<br>");
myLabelB: for(i=0; i<5; i++){ document.write("Ths value of i is: " + i + "<br>"); if(i==2){ break myLabelB; } } document.write("I did some more." + "<br>"); document.write("The value of 5 x 5 is: " + y + "<br>"); --> </script> </body> </html>