Boolean Prototype Methods

The Boolean object has the overridable prototype methods toString() and valueOf(). The former is called when the object is treated as a string, while the latter is called when the object is treated as one of the other primitives.


console.log((true) + "X");
console.log((true) + 0);

trueX 1