Tom Ritchford
1 min readJun 14, 2019

--

This is particularly confusing since many other popular languages don’t do it that way. For example, Python goes to some effort to do it right so [], {} and so on are all falsy, and you can customize this for your own classes.

It also seems jarringly weird that NaN is falsy. Intuitively I would want only 0 to be falsy and all other numbers, including inf and NaN, to be truthy.

Good to know all this!

--

--

Responses (1)