Break specific nested loops

suggest change

We can name our loops and break the specific one when necessary.

outerloop:
for (var i = 0;i<3;i++){
    innerloup:
    for (var j = 0;j <3; j++){
        console.log(i);
        console.log(j);
        if (j == 1){
            break outerloop;    
        }
    }
}

Output:

0
0
0
1

Feedback about page:

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



Table Of Contents