3 ms·
That’s because of the "truthy-ish" nonsense mess inherited from JavaScript. You could say the same with 0, "", NaN. That being said, I wonder what was the log
by ElFitz 3y ago
That’s because of the "truthy-ish" nonsense mess inherited from JavaScript.
You could say the same with 0, "", NaN.
That being said, I wonder what was the logic behind the decision to implement that.
- rezonant 3y agoCoercing nullishness/undefined-ness to false arises from languages like C. It is an unfortunate footgun, but not what most people think of when they think of Javascript's coercion weirdnesses. Typescript supports this because it is a strict superset of Javascript. They certainly could have made TS strict mode complain about it though.