continue 语句(带有或不带标签引用)只能用在循环中。break 语句(不带标签引用),只能用在循环或 switch 中。通过标签引用,break 语句可用于跳出任何 JavaScript 代码块:
cars=["BMW","Volvo","Saab","Ford"];list:{document.write(cars[0] + "");document.write(cars[1] + "");document.write(cars[2] + "");break list;document.write(cars[3] + "");document.write(cars[4] + "");document.write(cars[5] + "");}
结果:
BMWVolvoSaab
参考: