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.