Number.valueOf() (Method)

Return the primitive numeric value of the object.

Availability:

ECMAScript edition - 2
JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Property/method value type:Number primitive
JavaScript syntax:-myNumber.valueOf()

A Number object is converted to a simple Number primitive. You probably won't need to do this very often yourself because JavaScript is smart enough to convert Number primitives to Number objects and vice versa whenever it needs to. This is a whole lot better than having to cast data types to get expressions to work, as you would have to in other programming languages. This help makes JavaScript very accessible to non-programmers.

See also:Cast operator, Number.prototype, valueOf()

Cross-references:

ECMA 262 edition 2 - section - 15.7.4.3

ECMA 262 edition 3 - section - 15.7.4.4