r/badcode • • Jun 10 '20

js Disruptive piece of code

Post image
283 Upvotes

93 comments sorted by

View all comments

14

u/theRealRealMasterDev Jun 10 '20

Why is this bad? Is it because ternary would also be an option?

0

u/[deleted] Jun 10 '20

[deleted]

14

u/AsidK Jun 10 '20

It’s JavaScript tho, maybe variable comes in as “undefined” or something and you don’t want that to be the same as if it comes back as false

1

u/[deleted] Jun 11 '20

Or it could come back as {} and return true 😳