还有 for...in do...while while continue breakfor example:function ForInDemo(){ // Create some variables. var a, key, s = ""; // Initialize object. a = {"a" : "Athens" , "b" : "Belgrade", "c" : "Cairo"} // Iterate the properties. for (key in a) { s += a[key] + "<BR>"; } return(s); } function GetDriveList(){ var fso, s, n, e, x; fso = new ActiveXObject("Scripting.FileSystemObject"); e = new Enumerator(fso.Drives); s = ""; do { x = e.item(); s = s + x.DriveLetter; s += " - "; if (x.DriveType == 3) n = x.ShareName; else if (x.IsReady) n = x.VolumeName; else n = "[Drive not ready]"; s += n + "<br>"; e.moveNext(); } while (!e.atEnd()); return(s); } function BreakTest(breakpoint){ var i = 0; while (i < 100) { if (i == breakpoint) break; i++; } return(i); }function skip5(){ var s = "", i=0; while (i < 10) { i++; // Skip 5 if (i==5) { continue; } s += i; } return(s); }function BreakTest(breakpoint){ var i = 0; while (i < 100) { if (i == breakpoint) break; i++; } return(i); }
for...in
do...while
while
continue
breakfor example:function ForInDemo(){
// Create some variables.
var a, key, s = "";
// Initialize object.
a = {"a" : "Athens" , "b" : "Belgrade", "c" : "Cairo"}
// Iterate the properties.
for (key in a) {
s += a[key] + "<BR>";
}
return(s);
}
function GetDriveList(){
var fso, s, n, e, x;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives);
s = "";
do
{
x = e.item();
s = s + x.DriveLetter;
s += " - ";
if (x.DriveType == 3)
n = x.ShareName;
else if (x.IsReady)
n = x.VolumeName;
else
n = "[Drive not ready]";
s += n + "<br>";
e.moveNext();
}
while (!e.atEnd());
return(s);
}
function BreakTest(breakpoint){
var i = 0;
while (i < 100)
{
if (i == breakpoint)
break;
i++;
}
return(i);
}function skip5(){
var s = "", i=0;
while (i < 10)
{
i++;
// Skip 5
if (i==5)
{
continue;
}
s += i;
}
return(s);
}function BreakTest(breakpoint){
var i = 0;
while (i < 100)
{
if (i == breakpoint)
break;
i++;
}
return(i);
}