Class

Number

 Wraps a numeric value.

QuickLinks

Number, toExponential, toFixed, toLocaleString, toPrecision, toSource, toString, valueOf

Class

PropertyTypeAccessDescription
MAX_VALUEnumber readonlyA constant representing the largest representable number. (default: 1.7976931348623158e+308)
MIN_VALUEnumber readonlyA constant representing the smallest representable number. (default: 2.2250738585072014e-308)
NEGATIVE_INFINITYnumber readonlyA constant representing negative infinity.
NaNnumber readonlyA constant representing the special "Not a Number" value. (default: NaN)
POSITIVE_INFINITYnumber readonlyA constant representing positive infinity.

Methods

Constructor

Number Number (value: any)
Returns a new Number object set to the value of the argument converted to a number.

ParameterTypeDescription
value any The value of the object being created.

Examplenew Number(value)

Instances

number toExponential (decimals: number)
Converts the Number object to a string in scientific notation.

ParameterTypeDescription
decimalsnumberThe number of decimals.

number toFixed (decimals: number)
Converts the Number object to a string with fixed decimals.

ParameterTypeDescription
decimalsnumberThe number of decimals.

number toLocaleString ()
Returns the value of a Number object converted to a string, using localized conventions.

number toPrecision (decimals: number)
Converts the Number object to a string in either scientific or fixed notation, epending on its value.

ParameterTypeDescription
decimalsnumberThe number of decimals.

number toSource ()
Creates a string representation of this object that can be fed back to eval() to re-create an object. Works only with built-in classes.

number toString ([radix: number])
Returns the value of a Number object converted to a string.

ParameterTypeDescription
radixnumberThe optional conversion radix. (Optional)

Examplenum.toString(16)

number valueOf ()
Returns the value of a Number object as a primitive number.

Examplenum.valueOf()

Return

Number Number.Number (value: any)

Jongware, 28-Apr-2012 v3.0.3iContents :: Index