Intl.PluralRules.prototype.selectRange()

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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