|
|
|
|
|
by Raphmedia
2491 days ago
|
|
> Or if you are programming defensively – by choice or because the codebase is messy. This accurately describes the majority of JavaScript projects I have worked on. The last web agency I worked at even had linters checking against '=='. See this table https://dorey.github.io/JavaScript-Equality-Table/ which displays how unsure you can end up when using '=='. > Most JavaScript developers (who aren't familiar with JS coercion rules or the difference between == and ===) It rings strange to me that you would believe that developers who focus on one language ("JavaScript developers") wouldn't know the quirks of that language. Not all JS devs are juniors. I prefer to follow this rule, "never use == and != unless you need type coercion". You know that your expected results is 'true' then why not test for that only? |
|