JS: Boolean.prototype
What is boolean.prototype
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.console.assert(Boolean.prototype.constructor === Boolean); console.assert(true.constructor === Boolean);
Boolean.prototype.valueOf()-
Convert boolean object to primitive boolean.
console.assert((new Boolean(true)).valueOf()); console.assert((new Boolean(false)).valueOf() === false);
Boolean.prototype.toString()-
Convert boolean to string
"true"or"false".console.assert(true.toString() === "true"); console.assert(false.toString() === "false");