Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptJavaScript Intl ListFormat resolvedOptions() Method

JavaScript Intl ListFormat resolvedOptions() Method

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 neveropen = new Intl.ListFormat("de-DE", { style: "short" });
      
    const result = neveropen.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 neveropen = new Intl.ListFormat("hi");
      
    const result = neveropen.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
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments