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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -