This documentation is archived and is not being maintained.
Labeled Statement
Visual Studio 2005
Provides an identifier for a statement.
label : [statements]
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)
}
Show: