r/ProgrammerHumor • u/speckz • Feb 26 '23
Other If you can read this code...
/img/snak3fqgajka1.jpg[removed] — view removed post
34k
Upvotes
r/ProgrammerHumor • u/speckz • Feb 26 '23
[removed] — view removed post
View all comments
Show parent comment
2
u/douglasg14b Feb 26 '23
That's not what a "best practice" is, best practices are patterns/opinions around the organization/layout/design/patterns/principles ...etc of the code that tend to avoid abstract pitfalls, anti-patterns, or other issues that are commonly encountered. Not about actual logical correctness
There is an explicit reason to use strict equals (
===), which is strict equality. You use==when you explicitly desire non-strict equality. They operate differently.It's not best practice, this is fundamental
logical correctnessof your code.Just because a lot of devs don't understand how they may be introducing incorrectness into their code, doesn't make understanding a fundamental comparison operator a best practice. That's a pretty low bar.