0
How does increments work in loops
for (let n=2; n<10; n++){ console.log(n); gives a count 2 to 9 while console.log(n++) give values 2,4,6,8 only...why is that? why is 3,5,7 excluded ... }
1 Réponse
+ 1
when you do .log(n++) you not only print but increment n so after first iteration n will be 3 then for will increase it, next .log(n++) will print and increase again