• JavaScript Video Tutorials

JavaScript Number - valueOf()



Description

This method returns the primitive value of the specified number object.

Syntax

Its syntax is as follows −

number.valueOf()

Return Value

Returns the primitive value of the specified number object.

Example

Try the following example.

<html>
   <head>
      <title>JavaScript valueOf() Method </title>
   </head>
   
   <body>      
      <script type = "text/javascript">
         var num = new Number(15.11234);
         document.write("num.valueOf() is " + num.valueOf());
      </script>      
   </body>
</html>

Output

num.valueOf() is 15.11234 
javascript_number_object.htm
Advertisements