+ 1
Please can any one help me explain why the answer to this code is "6"?
var i ,s; s=0; for(i=0; i<=3; i++){ s+=i; } document. write(s);
1 Réponse
+ 3
you're adding i to s every iteration.
1. 0+1 = 1
2. 1 + 2 = 3
3. 3 + 3 = 6
var i ,s; s=0; for(i=0; i<=3; i++){ s+=i; } document. write(s);