ES6 - constructor ()


Advertisements

Javascript Boolean constructor() method returns a reference to the Boolean function that created the instance's prototype.

Use the following syntax to create a Boolean constructor() method. It returns the function that created this object's instance.

boolean.constructor()

Example

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

The following output is displayed on successful execution of the above code.

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