THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

JavaScript Number valueOf() Method

JavaScript Number Reference JavaScript Number Reference

Example

Return the primitive value of a number:

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

The result of n will be:

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: 1.1

JavaScript Number Reference JavaScript Number Reference