javascript - simple modulo not returning list of values I expected -
i thought following list numbers 0 21 divisible 7, i.e. 7, 14, , 21. instead returns 22. why?
for (var = 0; <= 21; i++) { if (i % 7 === 0); } console.log(i);
btw, have no programming background , i'm struggling first language under belt. teeny tiny details doing me in. anyway, helping me see how placement of console.log affected result.
because don't print in loop, final value of i.
Comments
Post a Comment