Ooh, careful everybody. This is a third rail topic that’s likely to get electrified at any moment.
Can we all agree that JavaScript provides two very distinct equality operators, and not one? And that the language developers foresaw the need for both. So that recommending one over the other isn’t a choice for us to make.
I use both. I use one when I need to check if two values are the same. I use the other when I need to check if two things have strict equality. I encounter both needs in most projects.
Daniel Busłowicz: your concern for programmers who don’t really get complex coercion systems is sweet. Still, my approach to junior devs is to give them good designs, good test scripts, and good code reviews. That’s how they become better devs.
Advising our peers to get the right answer for the wrong reason doesn’t help them or us.
Thanks Seifeldin, for being brave enough to post this. I’m glad to finally find someone on my side of this pet peeve.