15.6.4.3 Boolean.prototype.valueOf()

2010-07-11

boolean Boolean.prototype.valueOf() throws TypeError

Returns the [[PrimitiveValue]] of this boolean object.

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

Code: (Meta Ecma)
Boolean.prototype.valueOf= 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;
return b;
}