The another trick is by setting the parent loop to reach the end and then break the current loop
function foo()
{
for(var k = 0; k < 4; k++){
for(var m = 0; m < 4; m++){
if(m == 2){
k = 5; // Set this then break
break;
}
console.log(m);
}
}
}