JavaScript | Intl.Collator.prototype.resolvedOptions() Method

The Intl.Collator.prototype.resolvedOptions() method is an inbuilt method in JavaScript which is used to return a new object with properties reflecting the locale and collation options computed during initialization of this Collator object.

Syntax:

collator.resolvedOptions()

Parameters: This function does not accept any parameter.

Return value: This method returns a new object with properties reflecting the locale and collation options computed during the initialization of the given Collator object.

Below examples illustarte the in Intl.Collator.prototype.resolvedOptions() Method JavaScript:



Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

var vall = new Intl.Collator('de', { sensitivity: 'base' })
var geek = vall.resolvedOptions();
  
console.log(geek.locale);           
console.log(geek.usage);        
console.log(geek.sensitivity);   
console.log(geek.ignorePunctuation); 
console.log(geek.collation);         
console.log(geek.numeric); 

chevron_right


Output:

"de"
"sort"
"base"
false
"default"
false

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

let geek = new Intl.Collator('de-DE');
let geek1 = new Intl.Collator('ar');
let geek2 = new Intl.Collator('hi');
let val1 = geek.resolvedOptions();
let val2 = geek1.resolvedOptions();
let val3= geek2.resolvedOptions();
console.log(val1.sensitivity);
console.log(val2.collation);
console.log(val3.numeric);

chevron_right


Output:

"variant"
"default"
false

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

  • Google Chrome
  • Firefox
  • Opera
  • Edge
  • IE
  • Safari

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.