false true? When you have a
Boolean instead of
false, that's when!
var bool = new Boolean; //=> Boolean bool == false; //=> true bool.toString(); //=> "false" bool ? "is true" : "is false" //=> "is true"
Why is this? Well, it turns out that calling
new Boolean actually returns
a object instead of a value:
typeof bool //=> "object" typeof bool.valueOf() //=> "boolean" bool.valueOf() ? "is true" : "is false" //=> "is false"
So objects are always truthy, even the
false object. Lesson learned, if you poke