通常,我看到它突破外部循环:
var i, j;
dance: for (i = 0; i < 20; i++) {
for (j = 0; j < 20; j++) {
console.log(i+'-'+j);
if (j === 10) { //normally, break only breaks the immediate loop
break dance; //this one breaks the loop labelled as dance
}
}
}?
//continue here after i = 0,j = 10
Run Code Online (Sandbox Code Playgroud)