Number (Type)

A native built-in type.

Availability:

ECMAScript edition - 2
Property/method value type:Number primitive

The number type defines objects that represent numbers and include the IEEE 754 NaN values in the set if the implementation is fully ECMA-compliant.

The number range is huge, representing the double precision 64 bit IEEE 754 set of values.

The IEEE 754 standard defines a large number of values that are considered to be not an actual number, and should be represented as NaN. Some implementations of IEEE 754 allow you to tell the difference between an overflow error and a divide by zero error. In JavaScript, all of these values are represented by a single NaN value and you cannot distinguish between them. The JavaScript NaN value is globally defined as a variable.

The Number type includes the values positive and negative Infinity and, internally at least, positive and negative zero are represented as two distinct values.

See also:Cast operator, Data Type, Floating point, Fundamental data type, Hexadecimal value, IEEE 754, Infinity, Integer, NaN, Octal value, Primitive value, ToBoolean, ToInt32, ToNumber, ToObject, ToPrimitive, ToUint16, ToUint32, Type, Type conversion, valueOf()

Cross-references:

ECMA 262 edition 2 - section - 4.3.19

ECMA 262 edition 2 - section - 8.5

ECMA 262 edition 3 - section - 4.3.20

ECMA 262 edition 3 - section - 8.5

O'Reilly JavaScript Definitive Guide - page - 34