JS: Boolean Object

By Xah Lee. Date: . Last updated: .

Boolean is the value of the property key "Boolean" of the global object. [JS: the Global Object]

console.log( window.Boolean === Boolean ); // true

Type

Boolean is a function.

[see JS: Value Types]

console.log ( typeof Boolean === "function" ); // true

Parent

Parent of Boolean is Function.prototype. [see JS: Prototype and Inheritance]

console.log ( Reflect.getPrototypeOf ( Boolean ) === Function.prototype ); // true

Purpose

Purpose of Boolean is:

  1. Implicitly called by JavaScript to convert value to true or false. example: in a if statement.
  2. Implicitly called by JavaScript to convert true or false to string, by first converting the value to boolean object, then use method toString.
  3. Has the property key "prototype" that holds valueOf and toString methods.

[see JS: true, false]

Boolean Constructor

[see JS: Boolean Constructor]

Properties

JS Boolean

  1. true, false

JS Object and Inheritance

  1. Object Overview
  2. Object Type
  3. Find Object's Type
  4. Prototype Chain
  5. Create Object
  6. Object Literal Expr
  7. Create Object with Parent X
  8. Get/Set Parent
  9. Show Prototype Chain
  10. Prevent Adding Property
  11. Clone Object
  12. Test Object Equality
  13. Add Method to Prototype

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. CSS
  3. JavaScript
  4. JS Obj Ref
  5. DOM
  6. SVG
  7. Blog