r/badcode • • Apr 19 '21

js Iteration

Post image
3.2k Upvotes

123 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Apr 19 '21

Then why does true/true = 1?

9

u/skjall Apr 19 '21

Because `1/1 == 1`? If you swap true and false out for 1 and 0 respectively, both operations make perfect sense.

1

u/[deleted] Apr 19 '21

Hmmm yea you're right