Web/JavaScript/Reference/Global objects/Intl/PluralRules/select

From Get docs


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

Syntax

pluralCategory = pluralRule.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 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

Specification
ECMAScript Internationalization API (ECMA-402)The definition of 'Intl.PluralRules.select()' in that specification.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
select Chrome

Full support 63

Edge

Full support 18

Firefox

Full support 58

IE

No support No

Opera

Full support 50

Safari

Full support 13

WebView Android

Full support 63

Chrome Android

Full support 63

Firefox Android

Full support 58

Opera Android

Full support 46

Safari iOS

Full support 13

Samsung Internet Android

Full support 8.0

nodejs Full support 10.0.0

Notes'

Full support 10.0.0

Notes'

Notes' Before version 13.0.0, only the locale data for en-US is available by default. See the PluralRules() constructor for more details.

Legend

Full support  
Full support
No support  
No support
See implementation notes.'
See implementation notes.


See also