4 ms·
For what it's worth, you should _always_ be using triple-equals in Javascript unless you have an overwhelmingly good reason not to. Many of the weird Javascript
by mhink 10y ago
For what it's worth, you should _always_ be using triple-equals in Javascript unless you have an overwhelmingly good reason not to. Many of the weird Javascript-isms people like to complain about are due to surprising type coercions, which don't happen with triple-equals (which behaves as you would expect- value equality without type coercion for primitive types and reference equality otherwise.)
- echelon 10y agoFor someone who uses a more than one language on a regular basis, triple equals is an annoying break with convention. It shouldn't be that easy to make a mistake by simply missing an extra character. This is one of many reasons I've taken to using TypeScript for all of my web frontend projects.
- robocat 10y agoHowever you still run into the same problems with > , < , <= , and =>. So you need to really really understand the corner cases (same as with C++).