4 ms·
You wouldn't. The argument is so straw-man that it verges on trolling.
by CognitiveLens 10y ago
You wouldn't. The argument is so straw-man that it verges on trolling.
- coldtea 10y agoActually you don't have to write such a thing to get the same BS behavior, and it's not a strawman at all. It's just a side-product of JS god-broken coercion rules and types, and those affect every statement one writes, down to the suggestion to use === instead of == for the most fundamental thing any language does: equality comparison. The example is just meant to showcase how far the brokeness can be taken...
- kls 10y agoActually I like the ability to == all known ducks. There are a lot of cases that we run into like a DB that we have no control over where they use null, '' or 0 as some form of indicator of no value, it's nice to be able to ignore all of those cases when one does not have control over the quality of data coming in the pipe. I tend to favor the mantra of be a liberal when consuming data and a conservative when exporting data and I find the == vs === does that very well. Sure it's a gotcha but no big surprise to most people that have been doing JS for any amount of time. I personally think it is a brilliant feature that save a lot of boilerplate when one understands the difference.