How to use label statement in Javascript

Description

You can label statements for later use with the following syntax:

label: statement

Example

The following code adds a label for the for loop.


var count = 10;
start: for (var i=0; i < count; i++) { 
   document.writeln(i); 
} 




















Home »
  Javascript »
    Javascript Introduction »




Script Element
Syntax
Data Type
Operator
Statement
Array
Primitive Wrapper Types
Function
Object-Oriented
Date
DOM
JSON
Regular Expressions