Provides an identifier for a statement.
label : statements
Labels are used by the break and continue statements to specify the statement to which the break and continue apply.
In the following statement the continue statement uses a labeled statement to create an array in which the third column of each row contains and undefined value:
function labelDemo(){
var a = new Array();
var i, j, s = "", s1 = "";
Outer:
for (i = 0; i < 5; i++)
{
Inner:
for (j = 0; j < 5; j++)
{
if (j == 2)
continue Inner;
else
a[i,j] = j + 1;
}
}
for (i = 0;i < 5; i++)
{
s = ""
for (j = 0; j < 5; j++)
{
s += a[i,j];
}
s1 += s + "\n";
}
return(s1)
}