15.6.4.2 Boolean.prototype.toString()

2010-07-11

string Boolean.prototype.toString() throws TypeError

Converts this boolean value to a string, resulting in true or false.

If this object is not a boolean nor an object with [[Class]] boolean a TypeError is thrown.

Code: (Meta Ecma)
Boolean.prototype.toString = function(){
var B = this;
if (Type(B) == "Boolean") var b = B;
else if (Type(B) == "Object" && B.[[Class]] == "Boolean") var b = B.[[PrimitiveValue]];
else throw TypeError;
if (b) return "true";
return "false";
}