JavaScript Number valueOf() method

Definition and usage

valueOf() The method returns the original value of the number.

Example

Get the original value of the number:

let num = 15;
let n = num.valueOf();

Try it yourself

Syntax

number.valueOf()

Parameter

No parameters.

Return value

Type Description
Number The original value of the number.

Technical details

Return value

number The original value. There is almost no need to explicitly call this method.

Thrown

Exception Description
TypeError An exception is thrown if the object that calls this method is not a Number.

Browser support

valueOf() It is an ECMAScript1 (ES1) feature.

All Browsers Fully Support ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support