javascript / latest / global_objects / intl / pluralrules / select.html /

Intl.PluralRules.select()

The Intl.PluralRules.prototype.select() method returns a string indicating which plural rule to use for locale-aware formatting.

Syntax

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

 new Intl.PluralRules('ar-EG').select(0);
// → 'zero'

new Intl.PluralRules('ar-EG').select(1);
// → 'one'

new Intl.PluralRules('ar-EG').select(2);
// → 'two'

new Intl.PluralRules('ar-EG').select(6);
// → 'few'

new Intl.PluralRules('ar-EG').select(18);
// → 'many'

Specifications

Browser compatibility

Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet Deno Node.js
select
63
18
58
No
50
13
63
63
58
46
13
8.0
1.8
10.0.0
Before version 13.0.0, only the locale data for en-US is available by default. See the PluralRules() constructor for more details.

See also

© 2005–2022 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/select