JavaScript Break specific nested loops


Example

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