5 ms·
The horror that arises in js is due to a combination of unfortunate things like function arity, and coercion. The one I was thinking of is the famous [1,2,10].
by alkonaut 7y ago
The horror that arises in js is due to a combination of unfortunate things like function arity, and coercion. The one I was thinking of is the famous
[1,2,10].map(parseInt)
It’s several things that on their own aren’t mad which taken together produces a crazy result. 10 as the default for an optional second argument of parseInt is fine. But map should only use a single argument closure by default. So map(parseInt) must be equivalent to map(x -> parseInt(x)).