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 breaks the j
loop 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 is any kind of break
that would break j
and i
so the result would be:
The number is 1
The number is 2
I was able to get around this problem with a if
and a variable. However, if a command such as break
exists, it would be better.