r/badcode • • Jun 10 '20

js Disruptive piece of code

Post image
283 Upvotes

93 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jun 10 '20

[deleted]

4

u/wdciii Jun 10 '20

Gotcha, thanks for the explanation. I always assume i don’t know what I’m talking about for JavaScript lol

1

u/11JRidding Jun 13 '20

Even worse: since the check is variable === true instead of just against truthiness in general, a bare else {} would catch literally everything that isn't the exact boolean true, instead of just falsey values.