12
Let’s say I have this loop for
that works based on my array
name:
var nomes = ["Nome 1", "Nome 2", "Nome 3"];
for(i = 0; i <= 2; i++) {
if(nomes[i] == "Nome 2") {
console.log(nomes[i]);
console.log("Stop!");
break;
}
}
I’m stopping him making use of the break
.
This is the right way to stop one loop
?
Thanks for the supplement on the cycle
forEach
.– user23124