// 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; }, };