Intl.NumberFormat.prototype.formatRangeToParts()
Baseline 2023Newly available
Since August 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The formatRangeToParts()
method of Intl.NumberFormat
instances returns an Array
of objects containing the locale-specific tokens from which it is possible to build custom strings while preserving the locale-specific parts. This makes it possible to provide locale-aware custom formatting ranges of number strings.
Syntax
js
formatRangeToParts(startRange, endRange)
Parameters
startRange
-
A
Number
,