Skip to content
Related Articles

Related Articles

Improve Article

JavaScript | Intl.Collator.supportedLocalesOf() Method

  • Last Updated : 31 Mar, 2020

The Intl.Collator.supportedLocalesOf() method is an inbuilt method in JavaScript which is used to return an array containing those of the provided locales that are supported in collation without having to fall back to the runtime’s default locale.


Intl.Collator.supportedLocalesOf(locales, options)

Parameters: This method accept two parameters as mentioned above and described below:

  • locales: This parameter is a string with a BCP 47 language tag, or an array of such strings.
  • options: It is an optional parameter. It is an object that have localeMatcher property. The localeMatcher is the locale matching algorithm to use. It has the values are “lookup” and “best fit”.

Return value: This method returns an array of strings representing a subset of the given locale tags.

Below examples illustrate the Intl.Collator.supportedLocalesOf() method in JavaScript:

Example 1:

const locales1 = ['ban', 'id-u-co-pinyin', 'de-ID'];


Array ["id-u-co-pinyin", "de-ID"]

Example 2:

const locales1 = ['ban', 'id-u-co-pinyin', 'de-ID'];
const options1 = { localeMatcher: 'lookup' };
let val = Intl.Collator.supportedLocalesOf(locales1, options1)



Supported Browsers: The borwsers supoorted by Intl.Collator.supportedLocalesOf() method are listed below:

  • Google Chrome
  • Firefox
  • Opera
  • Edge
  • IE
  • Safari
My Personal Notes arrow_drop_up
Recommended Articles
Page :