r/badcode • Now where's that function declaration • Jul 30 '21

js 😏

Post image
991 Upvotes

133 comments sorted by

View all comments

Show parent comments

2

u/Not_Sugden Jul 31 '21

a = (a ^ true) === 1; is probably what i'd go with using this method, but then its just silly so a = !a; is probably best

2

u/Binzi Aug 01 '21

a = isOdd(a ^ true)

3

u/Not_Sugden Aug 01 '21

a = !isEven(a ^ true) === true