Intl.PluralRules.prototype.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

selectRange(startRange, endRange)

Return value

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

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
Intl.PluralRules
# sec-intl.pluralrules.prototype.selectrange

Browser compatibility

BCD tables only load in the browser

See also