Developer Resources

Number

Overview

A wrapper class for the numeric-typed data.

Base Class

Object

Constructor

Number()
Number(value : Number)

Arguments

value
The value of the new Number object.

Methods

Number.toExponential
Returns a string that represents the number in exponential notation.
Number.toFixed
Returns a string with a certain precision that represents the number.
Number.toLocaleString
Returns a string that represents the number in a local format.
Number.toPrecision
Returns a string that represents the number to a specified number of significant digits.
Number.toString
Returns a string that represents the number.
Number.valueOf
Returns the primitive number value represented by the number.

Inherited Methods

Object.hasOwnProperty
Checks for the existence of an object property
Object.toLocaleString
Returns a string that represents the object.
Object.toString
Returns a string that represents the object.
Object.valueOf
Returns the 'primitive' value of the object.

Number.toExponential

function Number.toExponential() : String
function Number.toExponential(digits : Number) : String

Arguments

digits
The number of digits to be shown after the decimal point.

Returns

Returns a string that represents the number in exponential notation.

Description

Returns a string in exponential notation with one digit before the decimal point and the specified number of digits after the decimal point.

Number.toFixed

function Number.toFixed() : String
function Number.toFixed(digits : Number) : String

Arguments

digits
The number of digits to be shown after the decimal point.

Returns

Returns a string with a certain precision that represents the number.

Description

Returns a string that represents the number. Note: toFixed() does not use exponential notation and shows the number of digits after the decimal point. If no digits argument is specified, zero digits are shown.

Number.toLocaleString

function Number.toLocaleString() : String

Returns

Returns a string that represents the number in a local format.

Description

Returns a string that represents the number in a local format.

Number.toPrecision

function Number.toPrecision() : String
function Number.toPrecision(digits : Number) : String

Arguments

digits
The number of significant digits to be shown in the output.

Returns

Returns a string that represents the number to a specified number of significant digits.

Description

Returns a string in fixed format to the specified number of significant digits. If the number of significant digits isn't specified, return the number in the same way as Number.toString().

Number.toString

function Number.toString() : String
function Number.toString(base : Number) : String

Arguments

base
The base in which the number is to be shown.

Returns

Returns a string that represents the number.

Description

Returns a string that represents the number in a given base. If base is omitted, then base 10 is used to create the string that represents the number.

Number.valueOf

function Number.valueOf() : Number

Returns

Returns the primitive number value represented by the number.

Description

Returns the primitive number value represented by the number.