3 ms·
> that also means "if(blah !== 0)"! The empty string ("") is also falsy. So is `false`, obviously. And the bigint 0. And NaN. Here is the complete truth table:
by masklinn 4y ago
> that also means "if(blah !== 0)"!
The empty string ("") is also falsy. So is `false`, obviously. And the bigint 0. And NaN. Here is the complete truth table: https://262.ecma-international.org/#sec-toboolean https://262.ecma-international.org/#sec-toboolean
FWIW undefined and null are loosely equal to one another, it's one of the few cases where loose equality is legitimate. As in
if (blah != null)
will exclude null and undefined, and only those two[0]. That's step 2 and 3 of IsLooselyEqual: https://262.ecma-international.org/#sec-islooselyequal https://262.ecma-international.org/#sec-islooselyequal
[0] and Document.all but if you're dealing with that you're beyond the reach of god
- DonHopkins 4y agohttps://www.reddit.com/r/ProgrammerHumor/comments/225i15/proof_that_brendan_eich_never_really_cared_about/ https://www.reddit.com/r/ProgrammerHumor/comments/225i15/pro... "Proof that Brendan Eich never really cared about equality." https://i.imgur.com/j7u6KbR.png https://i.imgur.com/j7u6KbR.png
- masklinn 4y agoIf we're doing thunderdome, JS doesn't beat C++: https://howardhinnant.github.io/smf.jpg https://howardhinnant.github.io/smf.jpg
- Dylan16807 4y agoBy the time you're declaring copy and move constructors you're much deeper than equality checks.
- DonHopkins 4y ago