javascript / latest / global_objects / intl / pluralrules / selectrange.html /

Intl.PluralRules.selectRange()

The Intl.PluralRules.prototype.selectRange() method receives two values and returns a string indicating which plural rule to use for locale-aware formatting.

Syntax

formatRange(startRange, endRange)

Return value

A string representing the pluralization category of the number; 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.

Description

This function selects a pluralization category according to the locale and formatting options of an Intl.PluralRules object.

Examples

Using selectRange()

 new Intl.PluralRules('sl').selectRange(102, 201);
// → 'few'

 new Intl.PluralRules('pt').selectRange(102, 102);
// → 'other'

Specifications

Browser compatibility

Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet Deno Node.js
selectRange
No
No
No
No
No
15.4
No
No
No
No
15.4
No
No
No

See also

© 2005–2022 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