Skip to content

Latest commit

 

History

History
75 lines (64 loc) · 1.92 KB

File metadata and controls

75 lines (64 loc) · 1.92 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
Labeled Statement (JavaScript) | Microsoft Docs
01/18/2017
windows-client-threshold
devlang-javascript
language-reference
labeled_JavaScriptKeyword
JavaScript
TypeScript
DHTML
continue statement
labeled statement
identifiers, statements
019f898e-9e27-4be4-a22f-c5927c7fcae2
19
mikejo5000
mikejo
ghogen

Labeled Statement (JavaScript)

Provides an identifier for a statement.

Syntax

  
      label :  
   statements   

Parameters

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

statements
Optional. One or more statements associated with label.

Remarks

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

Example

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.

Outer:  
for (i = 1; i <= 10; i++) {  
   document.write ("<br />");  
   document.write ("i: " + i);  
   document.write (" j: ");  
  
Inner:  
   for (j = 21; j <= 30; j++) {  
      if (j == 24)  
          {  
          continue Inner;  
      }  
      document.write (j + " ");  
  }  
}  

Requirements

[!INCLUDEjsv3]

See Also

break Statement
continue Statement