4
For example, if I have the following code:
var i, j;
for (i = 1; i <= 3; i++) {
for (j = 1; j <= 3; j++) {
if (j === 3) { break; }
text += "The number is " + j + "<br>";
}
}
When using break, it interrupts the loop of the j
and the result is:
The number is 1
The number is 2
The number is 1
The number is 2
The number is 1
The number is 2
I want to know if there’s any kind of break
that would interrupt the j
and the i
so that the result was:
The number is 1
The number is 2
I did, with a if
and a variable, get around this problem. However, if there is a command like break
, would be better.