valueOf Method (Number)

Returns the primitive value of the specified number.

Syntax


number.valueOf()  

Parameters

This method has no parameters.

Return Value

Returns the number.

Remarks

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  

Requirements

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.