JS: Boolean Object
What is the Keyword “Boolean”
Boolean
is the value of the property key "Boolean"
of the Global Object
.
window.Boolean === Boolean
Type
Type of Boolean
is a function.
typeof Boolean === "function"
Parent
Parent of Boolean
is Function.prototype.
Reflect.getPrototypeOf ( Boolean ) === Function.prototype
Purpose
Purpose of Boolean
is:
- Implicitly called by JavaScript to convert value to boolean primitive. e.g. in a if-statement.
- Implicitly called by JavaScript to convert boolean primitive to object, so it can use methods such as
toString
. - Holds the property key
"prototype"
. Its value is the parent of all instance of boolean.