The abstract operation SetNumberFormatDigitOptions applies digit options used for number formatting onto the intl object.
The abstract operation InitializeNumberFormat accepts the arguments numberFormat (which must be an object), locales, and options. It initializes numberFormat as a NumberFormat object. The following steps are taken:
When the CurrencyDigits abstract operation is called with an argument currency (which must be an upper case String value), the following steps are taken:
A Number format function is an anonymous built-in function that has a [[NumberFormat]] internal slot.
When a Number format function F is called with optional argument value, the following steps are taken:
The length
property of a Number format function is 1.
The FormatNumericToString abstract operation is called with arguments intlObject (which must be an object with [[RoundingType]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], and [[MaximumFractionDigits]] internal slots), and x (which must be a Number or BigInt value), and returns a
The PartitionNumberPattern abstract operation is called with arguments numberFormat (which must be an object initialized as a NumberFormat) and x (which must be a Number or BigInt value), interprets x as a numeric value, and creates the corresponding parts according to the effective locale and the formatting options of numberFormat. The following steps are taken:
The PartitionNotationSubPattern abstract operation is called with arguments numberFormat (which must be an object initialized as a NumberFormat), x (which is a numeric value after rounding is applied), n (which is an intermediate formatted string), and exponent (an integer), and creates the corresponding parts for the number and notation according to the effective locale and the formatting options of numberFormat. The following steps are taken:
Numbering System | Digits |
---|---|
arab | U+0660 to U+0669 |
arabext | U+06F0 to U+06F9 |
bali | U+1B50 to U+1B59 |
beng | U+09E6 to U+09EF |
deva | U+0966 to U+096F |
fullwide | U+FF10 to U+FF19 |
gujr | U+0AE6 to U+0AEF |
guru | U+0A66 to U+0A6F |
hanidec | U+3007, U+4E00, U+4E8C, U+4E09, U+56DB, U+4E94, U+516D, U+4E03, U+516B, U+4E5D |
khmr | U+17E0 to U+17E9 |
knda | U+0CE6 to U+0CEF |
laoo | U+0ED0 to U+0ED9 |
latn | U+0030 to U+0039 |
limb | U+1946 to U+194F |
mlym | U+0D66 to U+0D6F |
mong | U+1810 to U+1819 |
mymr | U+1040 to U+1049 |
orya | U+0B66 to U+0B6F |
tamldec | U+0BE6 to U+0BEF |
telu | U+0C66 to U+0C6F |
thai | U+0E50 to U+0E59 |
tibt | U+0F20 to U+0F29 |
The FormatNumeric abstract operation is called with arguments numberFormat (which must be an object initialized as a NumberFormat) and x (which must be a Number or BigInt value), and performs the following steps:
The FormatNumericToParts abstract operation is called with arguments numberFormat (which must be an object initialized as a NumberFormat) and x (which must be a Number or BigInt value), and performs the following steps:
When the ToRawPrecision abstract operation is called with arguments x (which must be a finite non-negative Number or BigInt), minPrecision, and maxPrecision (both must be integers between 1 and 21), the following steps are taken:
When the ToRawFixed abstract operation is called with arguments x (which must be a finite non-negative Number or BigInt), minInteger (which must be an integer between 1 and 21), minFraction, and maxFraction (which must be integers between 0 and 20), the following steps are taken:
The UnwrapNumberFormat abstract operation gets the underlying NumberFormat operation for various methods which implement ECMA-402 v1 semantics for supporting initializing existing Intl objects.
The abstract operation SetNumberFormatUnitOptions resolves the user-specified options relating to units onto the intl object.
The abstract operation GetNumberFormatPattern considers the resolved unit-related options in the number format object along with the final scaled and rounded number being formatted and returns a pattern, a String value as described in
The abstract operation GetNotationSubPattern considers the resolved notation and exponent, and returns a String value for the notation sub pattern as described in
The abstract operation ComputeExponent computes an exponent (power of ten) by which to scale x according to the number formatting settings. It handles cases such as 999 rounding up to 1000, requiring a different exponent.
The abstract operation ComputeExponentHelper computes an exponent by which to scale a number of the given magnitude (power of ten of the most significant digit) according to the locale and the desired notation (scientific, engineering, or compact).
The NumberFormat constructor is the %NumberFormat% intrinsic object and a standard built-in property of the Intl object. Behaviour common to all service constructor properties of the Intl object is specified in
When the Intl.NumberFormat
function is called with optional arguments locales and options, the following steps are taken:
The Intl.NumberFormat constructor has the following properties:
The value of Intl.NumberFormat.prototype
is
This property has the attributes { [[Writable]]:
When the supportedLocalesOf
method is called with arguments locales and options, the following steps are taken:
The value of the length
property of the
The value of the [[AvailableLocales]] internal slot is implementation defined within the constraints described in
The value of the [[RelevantExtensionKeys]] internal slot is «
The value of the [[LocaleData]] internal slot is implementation defined within the constraints described in
The Intl.NumberFormat prototype object is itself an ordinary object. %NumberFormatPrototype% is not an Intl.NumberFormat instance and does not have an [[InitializedNumberFormat]] internal slot or any of the other internal slots of Intl.NumberFormat instance objects.
The initial value of Intl.NumberFormat.prototype.constructor
is the intrinsic object
The initial value of the @@toStringTag property is the String value
This property has the attributes { [[Writable]]:
Intl.NumberFormat.prototype.format is an accessor property whose set accessor function is
Array.prototype.map
or other functions.
This is considered a historical artefact, as part of a convention which is no longer followed for new features, but is preserved to maintain compatibility with existing programs.
When the formatToParts
method is called with an optional argument value, the following steps are taken:
This function provides access to the locale and formatting options computed during initialization of the object.
Internal Slot | Property |
---|---|
[[Locale]] | |
[[NumberingSystem]] | |
[[Style]] | |
[[Currency]] | |
[[CurrencyDisplay]] | |
[[CurrencySign]] | |
[[Unit]] | |
[[UnitDisplay]] | |
[[MinimumIntegerDigits]] | |
[[MinimumFractionDigits]] | |
[[MaximumFractionDigits]] | |
[[MinimumSignificantDigits]] | |
[[MaximumSignificantDigits]] | |
[[UseGrouping]] | |
[[Notation]] | |
[[CompactDisplay]] | |
[[SignDisplay]] |
Intl.NumberFormat instances are ordinary objects that inherit properties from
Intl.NumberFormat instances have an [[InitializedNumberFormat]] internal slot.
Intl.NumberFormat instances also have several internal slots that are computed by the constructor:
Finally, Intl.NumberFormat instances have a [[BoundFormat]] internal slot that caches the function returned by the format accessor (