JavaScript 布尔构造函数属性
javascriptweb developmentobject oriented programming更新于 2025/12/1 5:32:17
布尔构造函数属性返回创建布尔原型的构造函数 −
以下是 JavaScript 布尔构造函数属性的代码 −
示例
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
</style>
</head>
<body>
<h1>JavaScript Boolean constructor Property</h1>
<p class="sample"></p>
<button class="btn">点击此处</button>
<h3>Click on the above button to get the boolean constructor function</h3>
<script>
var bool = true;
document.querySelector(".btn").addEventListener("click", () => {
document.querySelector(".sample").innerHTML =
"The boolean constructor function: <br>" + bool.constructor;
});
</script>
</body>
</html>
输出

点击“CLICK HERE”按钮 −

相关文章
有用资源
javascript 参考教程 - 该教程包含有关 javascript 的更多信息:https://www.cainiaomax.com/javascript/

