Book Image

Object-Oriented JavaScript

Book Image

Object-Oriented JavaScript

Overview of this book

Table of Contents (18 chapters)
Object-Oriented JavaScript
Credits
About the Author
About the Reviewers
Preface
Built-in Functions
Regular Expressions
Index

Boolean


The Boolean constructor creates boolean objects (not to be confused with boolean primitives). The boolean objects are not very 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.