无涯教程-Javascript - constructor函数

30 阅读1分钟

JavaScript boolean constructor()方法返回对创建原型的布尔函数的引用。

constructor - 语法

boolean.constructor()

constructor - 返回值

返回创建此对象的函数。

constructor - 示例

<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] }

参考链接

www.learnfk.com/javascript/…