This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

valueOf

Summary

Returns the primitive value of the specified number.

Syntax

number.valueOf()

Return Value

Returns the number.

Examples

In the following example, the instantiated number object is the same as the return value of this method.

var num = 1234;
 var s = num.valueOf();

 if (num === s)
 document.write("same");
 else
 document.write("different");

 // Output:
 // same

Attributions

  • Microsoft Developer Network: Article