开发学院

您的位置:首页>教程>正文

教程正文

ES6 Boolean属性constructor()

ES6 Boolean属性constructor()

  Boolean对象constructor()方法返回对创建此对象的 Boolean 函数的引用。

例子

<html> 
   <head> 
      <title>JavaScript constructor() Method</title> 
   </head> 

   <body> 
      <script type = "text/javascript"> 
         var bool = new Boolean(); 
         document.write("bool.constructor() is : " + bool.constructor); 
      </script> 
   </body>
</html>

 

  在成功执行上述代码时显示以下输出。

bool.constructor() is : function Boolean() { [native code] }