+ 2
[Js] Increase variable by 6 and then skip 5 numbers and increase to 6 again
Okay so lets say we have variable i in the loop for(i = 11111; i < 11141; i++) { console.log(i); } the output will go from 11111 to 11140 How can I change this loop to make i console.write(); from 11111 to 11116 and then from 11116 to 11121 (a difference of 5) ? If you still can't understand let me know and will explain it more in detail. In the meantime thanks for reading :)
1 Antwort
+ 2
i++ is an equivalent to i+=1, so simply change i++ to i+=5:
for(i=11111; i<11141; i+=5){
...
}