Open In App

JavaScript Intl ListFormat resolvedOptions() Method

Last Updated : 24 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The Intl.ListFormat.prototype.resolvedOptions() method is an inbuilt method in JavaScript that returns a new object that has characteristics that correspond to the locale and style formatting choices that were determined during the creation of the existing 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.

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

Example 1: In this example, we will see the use of the Intl.ListFormat.prototype.resolvedOptions() method in JavaScript.

javascript




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


Output: 

"de-DE"
"short"
"conjunction"

Example 2: In this example, we will see the use of the Intl.ListFormat.prototype.resolvedOptions() method in JavaScript.

javascript




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


Output:

"hi"
"long"
"conjunction"
undefined
undefined

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

  • Google Chrome 72 and above
  • Edge 79 and above
  • Firefox 78 and above
  • Opera 60 and above
  • Safari 14.1 and above

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads