Intl.PluralRules.select()

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

Specification
Unknown specification
# sec-intl.pluralrules.prototype.selectrange

Browser compatibility

BCD tables only load in the browser

See also