created by Brian LeRoux & Andrew Lunny. sparodically uncurated by David Trejo.

2013 03 25 null to bool

    null == false // false

Okay, we know this. Null doesn't convert to boolean.

Now try this...

    !null // true

Well, this is awkward.


The issue here is that Null can be converted to a boolean, it just isn't implicitly converted:

    Boolean(null) // false

See The Abstract Equality Comparison Algorithm
Null is only implicitly converted if compared to undefined


Fork me on GitHub