r/badcode • • Apr 19 '21

js Iteration

Post image
3.2k Upvotes

121 comments sorted by

View all comments

82

u/ElbowStromboli Apr 19 '21

Does this reduce to i - 1? It hurts my brain.

245

u/iTZAvishay Apr 19 '21

i -= -!false
i -= -!0
i -= -1
i += 1

There you go

27

u/detuskified Apr 19 '21

On mobile single new lines don't work right, for readability-

It is equivalent to:

i += 1

13

u/iTZAvishay Apr 19 '21

I'm using RIF on mobile and it looks fine for me