+ 3
Break and Continue
Could someone please explain? I did the last question of "Break and Cotinue" The question was "What is the output of this code? var sum=0 for(i=4; i<8; i++){ if(i==6){ continue; } sum+=i; } document.write(sum); Output;16
1 Antwort
+ 6
if i == 6 it will ignore the rest of the code for that index, so it won't sum +=6, for the rest of the i in that for statement it will. So you have
0+4=4
4+5=9
"skip" i=6 and continue with the rest, so
9+7=16