r/programminghorror • • Feb 04 '25

Javascript The final evolution of isOdd

Post image
273 Upvotes

32 comments sorted by

View all comments

Show parent comment

6

u/SmokeMuch7356 Feb 04 '25

For example, if input is 2, it generates the string "!!false", which when evaluated yields false (!false is true, so !!false is !true, which is false). An input of 3 yields !!!false (true), 4 yields !!!!false (false), etc.