ES6 - valueOf ()


Advertisements

Javascript Boolean valueOf() method returns the primitive value of the specified Boolean object.

Following is the syntax for the same.

boolean.valueOf()

Example

<html>
   <head>
      <title>JavaScript toString() Method</title>
   </head>
   <body>
      <script type="text/javascript">
         var flag = new Boolean(false);
         document.write( "flag.valueOf is : " + flag.valueOf());
      </script>
   </body>
</html>

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

flag.valueOf is : false
Advertisements