Computer >> Computer tutorials >  >> Programming >> Javascript

How to use a Boolean in JavaScript Constructors?


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

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

   <body>
      <script>
         var bool = new Boolean( );
         document.write("bool.constructor() is:"+bool.constructor);
      </script>
   </body>
</html>