The Number object in JavaScript.

Properties

The properties in ALL CAPS are static properties that are accessed directly from the prototype as opposed to an instance.

.constructor.  See Object.contstuctor.

.MAX_VALUE. The largest number representable in JS, approximately 1.79E+308.

.MIN_VALUE. The smallest number representable in JS, approximately 5E-324.

.NaN. Special "Not a Number" value.  The same as the top-level property NaN.

.NEGATIVE_INFINITY. Special value representing negative infinity; returned on overflow. The same as the top-level property Infinity.

.POSITIVE_INFINITY. Special value representing infinity; returned on overflow.

.prototype. Allows the addition of properties to a Number object.

Methods

.toExponential([fractionDigits]). Returns a string representing the number in exponential notation.

.toFixed([digits]). Returns a string representing the number with the specified number of digits after the decimal point. Defaults to no digits.

.toLocaleString(). Returns a string representing the nuber is a human readable format.

.toPrecision([digits]). Returns a string representing the number in fixed or exponential notation for the specified number of significant digits.

.toSource(). Returns an object literal representing the specified Number object; you can use this value to create a new object. Overrides the Object.toSource() method.

.toString(). Returns a String representing the specified object. Overrides the Object.toString() method.

.valueOf(). Returns the primitive value of the specified object. Overrides the Object.valueOf() method.

Miscellany

Miscellaneous notes pertaining to numbers in JavaScript as well as the Number object.

There are two kinds of number literals in JavaScript:

For evaluating expressions as numbers in JS: Literal numbers have the value stated, but others depend on context.

Page Modified: (Hand noted: 2007-08-08 18:21:19Z) (Auto noted: 2009-04-09 19:39:13Z)