Class

Number

 A wrapper class for numbers.

QuickLinks

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

Properties

PropertyTypeAccessDescription
MAX_VALUEnumberreadonlyA constant representing the largest representable number. (default: 1.7976931348623158e+308)
MIN_VALUEnumberreadonlyA constant representing the smallest representable number. (default: 2.2250738585072014e-308)
NEGATIVE_INFINITYnumberreadonlyA constant representing negative infinity.
NaNnumberreadonlyA constant representing the special "Not a Number" value. (default: NaN)
POSITIVE_INFINITYnumberreadonlyA constant representing positive infinity.

Methods

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.

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.

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

Return

Number Number.Number (value:any)

Contents :: Index