Since August 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The selectRange() method of Intl.PluralRules instances receives two values and returns a string indicating which plural rule to use for locale-aware formatting of the indicated range.
selectRange(startRange, endRange)
startRangeA number representing the start of the range.
endRangeA number representing the end of the range.
A string representing the pluralization category of the specified range. This can be one of zero, one, two, few, many or other, that are relevant for the locale whose localization is specified in LDML Language Plural Rules.
This function selects a pluralization category according to the locale and formatting options of an Intl.PluralRules object.
Conceptually the behavior is the same as getting plural rules for a single cardinal or ordinal number. Languages have one or more forms for describing ranges, and this method returns the appropriate form given the supplied locale and formatting options. In English there is only one plural form, such as "1–10 apples", and the method will return other. Other languages can have many forms.
new Intl.PluralRules("sl").selectRange(102, 201); // 'few'
new Intl.PluralRules("pt").selectRange(102, 102); // 'other'
| Desktop | Mobile | Server | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | Bun | Deno | Node.js | |
selectRange |
106 | 106 | 116 | 92 | 15.4 | 106 | 116 | 72 | 15.4 | 20.0 | 106 | 15.4 | 1.0.3 | No | 19.0.0 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/selectRange