JS: Boolean.prototype

By Xah Lee. Date: . Last updated: .

What is Boolean.prototype

Boolean.prototype is the value of the property key "prototype" of the function Boolean. [see Boolean Object]

Boolean.hasOwnProperty ( "prototype" ) 

Type

Type of Boolean.prototype is Object .

typeof Boolean.prototype === "object"

Boolean.prototype is a boolean object.

Reflect.apply ( Object.prototype.toString, Boolean.prototype , [] ) === "[object Boolean]"
Reflect.apply ( Boolean.prototype.valueOf, Boolean.prototype , [] ) === false

Parent

Parent of Boolean.prototype is Object.prototype .

Reflect.getPrototypeOf ( Boolean.prototype ) === Object.prototype 

Purpose

Purpose of Boolean.prototype is to hold methods valueOf and toString for converting values to true or false, or a string form.

Properties

Boolean.prototype.constructor
Value is Boolean.
Boolean.prototype.constructor === Boolean 
true.constructor === Boolean 
val.valueOf()
Convert val to true or false.
true.valueOf () === true 
false.valueOf () === false 
val.toString()
Convert val to "true" or "false".
true.toString () === "true" 
false.toString () === "false" 

JavaScript, Boolean

BUY ΣJS JavaScript in Depth