| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/break | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.
let i = 0;
while (i < 6) {
if (i === 3) {
break;
}
i = i + 1;
}
console.log(i);
// Expected output: 3
break [label];
label Optional . switch .
break label label . break label . label block . , loop .
i 3 while loop break , 3 * x .
function testBreak(x) {
var i = 0;
while (i < 6) {
if (i == 3) {
break;
}
i += 1;
}
return i * x;
}
label break . break label . inner_block outer_block .
outer_block: {
inner_block: {
console.log("1");
break outer_block; // inner_block outer_block
console.log(":-("); //
}
console.log("2"); //
}
label break break block_2 block_1 (Syntax Error) . break label .
block_1: {
console.log('1');
break block_2; // SyntaxError: label
}
block_2: {
console.log('2');
}
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-break-statement |
This page was last modified on 2025 2 11 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |