Intl.PluralRules.prototype.selectRange()

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

Syntax

js

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()

js

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

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

Specifications

Specification
ECMAScript Internationalization API Specification
# sec-intl.pluralrules.prototype.selectrange

Browser compatibility

BCD tables only load in the browser

See also