Boolean
The Boolean
constructor creates Boolean objects (not to be confused with Boolean primitives). The Boolean objects are not that useful and are listed here for the sake of completeness.
> var b = new Boolean(); > b.valueOf(); false > b.toString(); "false"
A Boolean object is not the same as a Boolean primitive value. As you know, all objects are truthy:
> b === false; false > typeof b; "object"
Boolean objects don't have any properties other than the ones inherited from Object
.
Get JavaScript : Object-Oriented Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.