+ 1
Am requesting for some help on how the output of this code block is 16, in JavaScript. Please.
var sum = 0; for (i=4; i<8; i++) { if (i==6) { continue; } sum += i; } document.write(sum);
2 Réponses
+ 5
First iteration:
i = 4 -> sum = 0+4 = 4
Second iteration:
i = 5 -> sum = 4+5 = 9
Third iteration:
i = 6 -> continue -> addition is skipped
Fourth iteration:
i = 7 -> sum = 9+7 = 16
Loop ends.
+ 3
Please always tag the language you're asking about.
https://code.sololearn.com/W3uiji9X28C1/?ref=app