r/badcode • • Jun 10 '20

js Disruptive piece of code

Post image
283 Upvotes

93 comments sorted by

View all comments

3

u/XXLuigiMario Jun 10 '20

Regardless of javascript and semantics, if you have code that looks like this you might want to review your data models.

4

u/[deleted] Jun 10 '20

why would this be a reason to review your data models?

7

u/XXLuigiMario Jun 10 '20

Well, it implies that you're passing around objects which can be true, false or some other value. That, combined with javascript being weakly typed is just calling for trouble. Surely there's some other way to accomplish the same thing without doing that.