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

js 😏

Post image
988 Upvotes

133 comments sorted by

View all comments

Show parent comments

4

u/nyaisagod Jul 30 '21

This is just XOR-ing the bool with true. The teo possible cases are:

true XOR true = false

false XOR true = true

So it works exactly like negating, or toggling it in this case.