0

# sum ＋=i

var sum = 0; for (i=4;i<8;i＋＋){ if(i==6){ continue;} sum=+1;} why sum is 16 ?

1 Answer

+ 13

Your code is wrong, its sum += i (i.e. sum = sum+i) only then you can get 16.
0+4 = 4
4+5 = 9
Now, leaving 6 because of the continue statement, i would move on to the next iteration that is 7.
9+7 = 16
And, the loop terminates!