let primeNumber = 2;
nextPrime:
for(let i = 2; i <= primeNumber; i++) {
for(let j = 2; j < i; j++) {
if(i % j == 0) {continue nextPrime;}
}
alert(i);
}
so, the output would be only 2, but my question is when the ‘continue’ gets executed, the loop gets iterated and the value for i goes from 2 to 3, but the alert function still outputs 2, whats exactly happening here?
The primeNumber is hardcoded because I want to know whats happening in this scenario.