How to use a Boolean in JavaScript Constructors?

JavascriptWeb DevelopmentFront End Technology

To use Boolean in JavaScript constructors, use JavaScript boolean constructor() method. It returns a reference to the Boolean function that created the instance's prototype.

Example

You can try to run the following code to learn how to use Booleans in Constructors

Live Demo

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

   <body>
      <script>
         var bool = new Boolean( );
         document.write("bool.constructor() is:"+bool.constructor);
      </script>
   </body>
</html>
raja
Published on 18-Jan-2018 13:12:08
Advertisements