What is the output of this code?
with explanation (comment your answers)
var sum=0;
for(i=4; i<8; i++) {
if (i == 6) {
continue;
}
sum += i;
}
document.write(sum);
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
Firstly we define a variable to 0.
We create a loop who start to 4 and stop to 7 because (i<8).
When i equal to 6 we continue to the next iteration i equal to 7.
Result :
the page display 16.
note : In the loop, post-increment is unnecessary, use pre-increment