Boolean objects in conditionals
petermichaux at gmail.com
Fri Nov 28 13:42:45 PST 2008
The following suggests (i.e. could be interpreted as) a false Boolean
object is a "truthy" value.
> (new Boolean(false)) ? "a" : "b"
The following suggests a false Boolean object is a "falsy" value
> ((new Boolean(false)) == true) ? "a" : "b"
I understand what is going on here but it seems like a bad state of affairs.
Does this need to be remedied? Can it be?
It would be useful to have an object that is effectively "false" in an
"if" conditional but which can also have properties like an object
More information about the Es-discuss