以下是示例布尔构造函数属性。
<script type = "text/javascript"> 
  var bool = false;
  document.write("bool.constructor:" 
          + bool.constructor); 
</script>  在JavaScript中, 布尔构造函数属性返回对象的构造函数。对于JavaScript布尔值, 构造函数属性返回函数Boolean(){[本地代码]}.
语法如下:
boolean.constructor返回值:它返回函数Boolean(){[native code]}。
上述属性的更多示例代码如下:
范例1:
此示例说明了布尔构造函数属性。
<!DOCTYPE html>
<html>
  
<head>
     <title>
         JavaScript Boolean constructor Property
     </title>
</head>
  
<body style = "text-align:center;">
  
     <div>
              
         <h1 style = "color: green;">lsbin</h1>
                  
         <p>
             JavaScript Boolean constructor Property
             returns the function that created
             the boolean's prototype:
         </p>
                  
         <b id = "GFG"></b>
          
     </div>
      
     <!-- Script to use boolean constructor -->
     <script>
         var bool = false;
         document.getElementById("GFG").innerHTML
                 = bool.constructor;
     </script>
</body>
  
</html>输出如下:
 
 
范例2:
此示例说明了布尔构造函数属性。
<!DOCTYPE html>
<html>
  
<head>
     <title>
         JavaScript Boolean constructor Property
     </title>
</head>
  
<body style = "text-align:center;">
  
     <div>
              
         <h1 style = "color: green;">lsbin</h1>
                  
         <p>
             JavaScript Boolean constructor Property
             returns the function that created
             the boolean's prototype:
         </p>
         <button onclick = "gfg()">Click me</button>
         <p id = "name"></p>
     </div>
      
     <!-- Script to use Boolean constructor Property -->
     <script>
     function gfg(){
         var bool = false;
         document.getElementById("name").innerHTML
                 = bool.constructor;
     }
     </script>
</body>
  
</html>输出如下:
 
 
支持的浏览器:支持的浏览器JavaScript布尔构造函数属性下面列出:
- 谷歌浏览器
- IE浏览器
- 火狐浏览器
- 苹果浏览器
- 歌剧

 
	
