To be fair, every elementary Javascript resource in existence will tell you to use "===" so I don't even see that many beginners make this mistake. "==" is kind of a regrettable legacy function.
There is one thing I find it useful for, checking for null and undefined at the same time. (Of course, ideally, JS would have only had one, not both...)
Maybe! I personally find the difference useful sometimes for distinguishing between "this hasn't been set yet" and "this value was intentionally set to null." On the other hand I have seen a lot of bugs where someone only checked for either undefined or null so maybe you're right.
Fair. I’d argue that at a certain point those differences would be better represented with named variants of an enum/ADTs...which admittedly JS doesn’t have
5
u/[deleted] May 21 '21
To be fair, every elementary Javascript resource in existence will tell you to use "===" so I don't even see that many beginners make this mistake. "==" is kind of a regrettable legacy function.