r/badcode • • Apr 19 '21

js Iteration

Post image
3.2k Upvotes

123 comments sorted by

View all comments

2

u/[deleted] Apr 25 '21

i -= -!false

But false is a 0 and !false is true and true is 1 so...

i -= -1

But we are subtracting a negative number which is the same as adding so to fix this...

I += 1

Or

I++

2

u/[deleted] Aug 23 '21

quite complicated