Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var arr1 = [1, 2, 3, 4];
var arr2 = [7, 8, 9, 1];
loop1: for (let element1 of arr1) {//define a breakpoint
for (let element2 of arr2) {
console.log(element1, " ", element2);
if (element1 === element2) {
console.log("duplicate numbers");
break loop1;//if a specific condition is met , break the loop
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment