JavaScript sai do loop
//break out of for loop
for (i = 0; i < 10; i++) {
if (i === 3) { break; }
}
Grepper
//break out of for loop
for (i = 0; i < 10; i++) {
if (i === 3) { break; }
}
breakme: if (condition) {
// Do stuff
if (condition2){
// do stuff
} else {
break breakme;
}
// Do more stuff
}
// The break statement breaks out of a switch or a loop.
let text = "";
for (let i = 0; i < 5; i++) {
if (i == 3) break;
text += i;
}
// output: 012