valueOf()  Number  instance method JS Home  <<  JS Reference  <<  Number  <<  valueOf()

Description

Returns the primitive value of the Number object.

This method overrides the valueOf() method of Object.

Syntax

Signature Description
aNumber.valueOf()Returns the primitive value of the Number object.

Parameters

None.

Examples

The code below creates a Number object and displays the primitive.


// Create a Number object.
someNumber = new Number();

alert(someNumber.valueOf()); 

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 3 - Number

JavaScript Basics

JavaScript Basics

JavaScript Intermediate

JavaScript Intermediate

JavaScript Advanced

JavaScript Advanced

JavaScript Reference

JavaScript Entities

Globals

Number

Class Properties
MAX_VALUE
MIN_VALUE
NaN
NEGATIVE_INFINITY
POSITIVE_INFINITY
prototype
Instance Properties
constructor
Class Methods
None.
Instance Methods Getters
toExponential()
toFixed()
toLocaleString()
toPrecision()
toString()
valueOf()
Instance Methods Setters
None.

Statements

Operators