THE WORLD'S LARGEST WEB DEVELOPER SITE

JavaScript Number valueOf() Method

❮ JavaScript Number Reference

Example

Return the primitive value of a number:

var num = 15;
var n = num.valueOf();
Try it Yourself »

Definition and Usage

The valueOf() method returns the primitive value of a number.


Browser Support

Method
valueOf() Yes Yes Yes Yes Yes

Syntax

number.valueOf()

Parameters

None

Technical Details

Return Value: A Number, representing the primitive value of a number
JavaScript Version: ECMAScript 1

❮ JavaScript Number Reference