<html>
<body>
<h1>JavaScript 布尔</h1>
<p>如果布尔值为 true,则显示 "green",否则显示 "red"。</p>
<p id="demo"></p>
<script>
Boolean.prototype.myColor = function() {
if (this.valueOf() == true) {
return "green";
} else {
return "red";
}
};
let a = true;
document.getElementById("demo").innerHTML = a.myColor();
</script>
</body>
</html>