0
Can someone please help me understand how the last quiz on break and continue gives an out put of 16
i thought id figured out how break and continue work concluding that it's out put would be a sequence of numbers !!
2 Respuestas
+ 2
var x = 0;
while (true) {
x++;
if(x%2 == 0) {
continue; // if the number is even go to the next iteration of the loop skipping the rest of
// the code within this while loop an going back to the top at the while condition.
}
if(x==10) {
break; // This will end the execution of the loop and jump to the code following it
}
console.log(x); // will only output odd values less than ten.
}
// here x will be equal to ten
0
thanks