ES6 - constructor()



Javascript 布尔值constructor()方法返回一个对创建实例原型的 Boolean 函数的引用。

使用以下语法创建 Boolean constructor() 方法。它返回创建此对象实例的函数。

boolean.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] }
广告
© . All rights reserved.