Source @ github

Labeled statement

label – Set a label in the code which can be used as point to go to.

Description

label:

Examples

Example #1 – break example

Breaking out of a label.

console.log('Before section label'); section: { break section; console.log('Never executed'); } console.log('After section label');
Example #2 – break example

Breaking out of nested labels.

section: { console.log('In section'); subSection: { console.log('In sub section'); break section; console.log('Never executed'); } console.log('Never executed'); } console.log('It can even be nested!');

External references