Intl.PluralRules.prototype.select()
The select()
method of Intl.PluralRules
instances returns a string indicating which plural rule to use for locale-aware formatting.
Try it
Syntax
js
select(number)
Parameters
number
-
The number to get a plural rule for.
Return value
A string representing the pluralization category of the number
, can be one
of zero
, one
, two
, few
,
many
or other
.
Description
This function selects a pluralization category according to the locale and formatting
options of a Intl.PluralRules
object.
Examples
Using select()
js
const pr = new Intl.PluralRules("ar-EG");
pr.select(0); // 'zero'
pr.select(1); // 'one'
pr.select(2); // 'two'
pr.select(6); // 'few'
pr.select(18); // 'many'
Specifications
Specification |
---|
ECMAScript Internationalization API Specification # sec-intl.pluralrules.prototype.select |
Browser compatibility
BCD tables only load in the browser