Number (Primitive value)

A built-in primitive value.

Availability:

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

A number value is a member of the type Number and is a direct representation of a number.

It is basically a floating-point number and there is no special integer number class. Integers are simply floating point values with a zero fractional part.

Numbers can be expressed as integers or floating point values. They can be expressed in decimal, octal or hexadecimal notation. They can also be expressed in exponential form.

Typical limits for the number type allow for very large number values. You can find out what the maximum value is by requesting the MAX_VALUE property from the built-in Number object. It will probably give you a value in the region of 1 followed by some 300 or more zeros. The smallest value is some 300 decimal places past the decimal point.

Actually the limits are 1.79e308 down to 5e-324 and both can be positive or negative.

There are special constants for the values Infinity and NaN. The Infinity value can be positive or negative. The NaN value represents a quantity that is known to be numeric but is not a valid value for the implementation. It can be tested for with the isNaN() function.

See also:Cast operator, Floating constant, Infinity, isNaN(), JavaScript to Java values, Number.MAX_VALUE, Number.MIN_VALUE, Primitive value

Cross-references:

ECMA 262 edition 2 - section - 4.3.19

ECMA 262 edition 3 - section - 4.3.19

Wrox Instant JavaScript - page - 14