Labeled Statement (JavaScript)


Provides an identifier for a statement.

   label :


Required. A unique identifier used when referring to the labeled statement.


Optional. One or more statements associated with label.

Labels are used by the break and continue statements to specify the statement to which the break and continue apply.


In the following code, the continue statement refers to the for loop that is preceded by the Inner: statement. When j is 24, the continue statement causes that for loop to go to the next iteration. The numbers 21 through 23 and 25 through 30 print on each line.

for (i = 1; i <= 10; i++) {
   document.write ("<br />");
   document.write ("i: " + i);
   document.write (" j: ");

   for (j = 21; j <= 30; j++) {
      if (j == 24)
          continue Inner;
      document.write (j + " ");


Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.