13 lines
313 B
JavaScript
13 lines
313 B
JavaScript
// Converts any value to a boolean, like the spec's ToBoolean
|
|
function Boolean(x) {
|
|
return !!x;
|
|
}
|
|
|
|
// In these methods `this` is the primitive boolean itself
|
|
Boolean.prototype = {
|
|
toString() { return this ? "true" : "false"; },
|
|
valueOf() { return this; },
|
|
};
|
|
|
|
__link_proto_boolean(Boolean.prototype);
|