3 ms·
I think the seemingly arbitrary behaviour of things like `[] + []` vs. `[] + {}` doesn't really affect you, as someone writing real JavaScript in the wild, very
by bshimmin 12y ago
I think the seemingly arbitrary behaviour of things like `[] + []` vs. `[] + {}` doesn't really affect you, as someone writing real JavaScript in the wild, very often (but perhaps they still might do occasionally, depending on what you're doing).
On the other hand, errors in logic because of truthiness/falsiness do occur pretty regularly in real code (I'm sure every JavaScript developer has at least once forgotten to check whether an argument is really undefined and then not very gracefully handled `0` being passed to that function)... and these problems do all have the same root cause: JavaScript's type system.