I have written the following loop:
for (i = 10; i--; i > 5) {
console.log(i);
}
Which outputs this to the console:
9
8
7
6
5
4
3
2
1
0
Can anyone tell me why it's doing this?
I had a look and it seems like it's just a simple matter of having to increment using the third parameter of the for loop, rather than the second, but I'm fascinated as to the digits logged to the console. Can anyone give me a simple explanation of why it outputs the numbers it does?