Name
label — NN 4 IE J3 ECMA n/a
Synopsis
You can assign a label identifier to any block of executing
statements, including control structures. The purpose of the label is
to allow break
and continue
statements within deeply nested control structures to exit to a
nested level that may be at levels beyond the scope of the normal
break
and continue
statements.
Syntax
labelName
:
Example
outerLoop: for (var i = 0; i <= maxValue1; i++) { for (var j = 0; j <= maxValue2; j++) { if (i == magic1 && j == magic2) { break outerLoop } } }
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.