Updated on Kisan Patel
Use labels to break from nested loops in JavaScript.
In JavaScript you can specify labels. To break from a specific nested loop, make sure you label it and use the construct:
break label_name;
loop1: for (const i of arr1) { loop2: for (const j of arr2) { loop3 for (const k of arr3) { break loop2; //breaks out of loop3 and loop2 } } }