+ 1
Why is the first log 0 and the second, 1 and so on. ... In the console i don't get it
for(x=0;x<=8;x++){ x+=x-x++; console.log(x) }
2 Answers
+ 1
Jsonâ
This snippet below does the same thing without the second line in your example.
I would like to say nasty things about that 2nd line as I disagree with bits of code that deliberately do nothing but cause confusion, (unless it is to try and protectively obfuscate)
for(x=0;x<=8;x++){
console.log(x)
}
+ 1
I agree with Rik, generally having a simple solution that works and is easy to understand is better than an unnecessarily complicated one, I personally favor having clear and understandable code for this reason.
Try looking at changing the different parts of the for loop to test your understanding of how the loop works.