parent
6713b059e1
commit
7fb089259d
2 changed files with 20 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||||||
|
JavaScript label statements are used to prefix a label to an identifier. It can be used with `break` and `continue` statement to control the flow more precisely. |
||||||
|
|
||||||
|
```js |
||||||
|
loop1: for (let i = 0; i < 5; i++) { |
||||||
|
if (i === 1) { |
||||||
|
continue loop1; // skips the rest of the code in the loop1 |
||||||
|
} |
||||||
|
console.log(`i: ${i}`); |
||||||
|
} |
||||||
|
// Output: |
||||||
|
// i: 0 |
||||||
|
// i: 2 |
||||||
|
// i: 3 |
||||||
|
// i: 4 |
||||||
|
``` |
Loading…
Reference in new issue