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

The Intl.ListFormat.prototype.resolvedOptions() method is an inbuilt method in JavaScript which returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current ListFormat object.

Syntax:

listFormat.resolvedOptions()

Parameters: This method does not accept any parameter.

Return Value: This method returns an object with properties reflecting the locale and formatting options computed during the construction of the given ListFormat object.

Below examples illustrate the Intl.ListFormat.prototype.resolvedOptions() method in JavaScript:



Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<script>
const geeks = new Intl.ListFormat("de-DE", { style: "short" });
  
const result = geeks.resolvedOptions();
console.log(result.locale); 
console.log(result.style);  
console.log(result.type); 
</script>

chevron_right


Output:

"de"
"short"
"conjunction"

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<script>
const geeks = new Intl.ListFormat("hi");
  
const result = geeks.resolvedOptions();
console.log(result.locale); 
console.log(result.style);  
console.log(result.type); 
console.log(result.collation); 
console.log(result.numeric); 
</script>

chevron_right


Output:

"hi"
"long"
"conjunction"
undefined
undefined

Supported Browsers: The browsers supported by Intl.ListFormat.prototype.resolvedOptions() method are listed below:

  • Google Chrome
  • Opera

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.