break and continue labels

suggest change

Break and continue statements can be followed by an optional label which works like some kind of a goto statement, resumes execution from the label referenced position

for(var i = 0; i < 5; i++){
  nextLoop2Iteration:
  for(var j = 0; j < 5; j++){
    if(i == j) break nextLoop2Iteration;
    console.log(i, j);
  }
}
i=0 j=0 skips rest of j values

1 0

i=1 j=1 skips rest of j values

2 0

2 1 > i=2 j=2 skips rest of j values

3 0

3 1

3 2

i=3 j=3 skips rest of j values

4 0

4 1

4 2

4 3

i=4 j=4 does not log and loops are done

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Loops:
* Syntax
* break and continue labels

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
64 Console
68 Symbols
73 Modals
76 Events
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde