JavaScript - valueOf() Method

Last Updated Jul 29, 2015, 07:00:14 PM





The JavaScript valueOf() method returns the primitive numeric value represented by the object.

Syntax

This method is usually called internally by JavaScript and not explicitly in web code.


Example

The example code shows how to return the primitive value of a number.


Try It Now


Other JavaScript Number Object Methods you might want to learn

toString()

toFixed()

toLocaleString()

toPrecision()

Browser compatibility

Feature
valueOf() Yes Yes Yes Yes Yes Yes Yes





Sources and Credits

The source of the content has been referred and updated with Mozilla Developer Network and W3C Organization

Last Updated Jul 29, 2015, 07:00:14 PM