Last updated 2 years ago
Was this helpful?
JS ⟩ statement ⟩ other ⟩ label
(statement)
prefixes a statement with an identifier which you can refer to.
<label> : <statement> // syntax
label is only used by break / continue.
( nested loop)
labeled statement is needed
when you want to to the next iteration of an outer loop that is not the nearest enclosing .
when you want to out of a statement that is not
The namespace for labels is different than the namespace for (s) and (s), the same can be used as label / variable or function name.
"the that you identify with a label may be any statement."
📘
flow control
continue
break
JavaScript: The Definitive Guide ⟩ 5.5.1 Labeled Statements
Statements and declarations ⟩ Others ⟩ label ⭐️
Loops and iteration ⟩ label statement