Created
January 20, 2020 15:05
-
-
Save deepakshrma/a81758b8dce80d0da579e963d32d2753 to your computer and use it in GitHub Desktop.
[labeledLoop] Weird Part: How to break the LOOP in JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function labeledLoop() { | |
| let x = 0; | |
| let z = 0; | |
| outer: while (true) { | |
| console.log("Outer loops: " + x); | |
| x += 1; | |
| z = 1; | |
| while (true) { | |
| console.log("Inner loops: " + z); | |
| z += 1; | |
| if (z === 10 && x === 10) { | |
| break outer; | |
| } else if (z === 10) { | |
| break; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment