JavaScript - Boolean valueOf() Method


Advertisements


Description

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

Syntax

Its syntax is as follows −

boolean.valueOf()

Return Value

Returns the primitive value of the specified boolean object.

Example

Try the following example.

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

Output

flag.valueOf is : false 

javascript_boolean_object.htm