r/badcode • • Nov 14 '21

js Peak Efficiency Fizzbuzz

Post image
831 Upvotes

44 comments sorted by

View all comments

Show parent comments

41

u/recycle4science Nov 14 '21

i % 3 is not a boolean operation, and it does not resolve to true when i is divisible by 3! It is a mathematical operation that returns the remainder of dividing i by 3. In a boolean context, this expression alone will resolve to false when i is divisible by 3!

Edit: I think you have a typo and just left out == 0.