JavaScript valueOf() Method
Example
Returns the primitive numeric value of a Number object:
var num = 15;
var n = num.valueOf();
n Output result:
Try it »
Definition and Usage
The valueOf() method returns the number as a string.
Browser support





All major browsers support the valueOf() method
Syntax
number
.valueOf()
Return Value
| Type | Description |
|---|---|
| Number | The primitive value of a number |
Technical Details
| JavaScript version: | 1.1 |
|---|
JavaScript Number object