+ 5
Looping Problem
for(var i=0;i<=10;i+=2){ } document.write(i); i know the answer is 12, but when i try this : for(var i=0;i<=10;i+=3){ } document.write(i); why i still 12 ??
2 ответов
+ 14
Because the iterator is incremented like this:
0, 3, 6, 9, 12 - oh, not smaller than or equal to 10 anymore, time to leave the loop.
+ 9
Because 12 is the first multiple of both 3 and 2 to be greater than 9...