Last Updated : 12 Jul, 2025
The Intl.ListFormat.prototype.format() method is an inbuilt method in JavaScript that returns a string with a language-specific representation of the list.
Syntax:
listFormat.format([list]);
Parameters: This method accepts a single parameter as mentioned above and described below:
Return Value: This method returns a language-specific formatted string representing the elements of the list.
The below examples illustrate the Intl.ListFormat.prototype.format() method in JavaScript:
Example 1: In this example, we will return a string from an array using the Intl.ListFormat.prototype.format() method in JavaScript.
javascript
<script>
const gfg = ['Geeks1', 'Geeks2', 'Geeks3', 'Geeks4'];
const result1 = new Intl.ListFormat('en',
{ style: 'long', type: 'conjunction' });
console.log(result1.format(gfg));
const result2 = new Intl.ListFormat('db',
{ style: 'short', type: 'disjunction' });
console.log(result2.format(gfg));
const result3 = new Intl.ListFormat('en',
{ style: 'narrow', type: 'unit' });
console.log(result3.format(gfg));
</script>
Output:
"Geeks1, Geeks2, Geeks3, and Geeks4" "Geeks1, Geeks2, Geeks3, or Geeks4" "Geeks1 Geeks2 Geeks3 Geeks4"
Example 2: In this example, we will return a string from an array using the Intl.ListFormat.prototype.format() method in JavaScript.
javascript
<script>
const gfg = ['Geeks1', 'Geeks2', 'Geeks3', 'Geeks4'];
const result1 = new Intl.ListFormat('hi',
{ style: 'long', type: 'conjunction' });
console.log(result1.format(gfg));
const result2 = new Intl.ListFormat('hi',
{ style: 'short', type: 'disjunction' });
console.log(result2.format(gfg));
const result3 = new Intl.ListFormat('hi',
{ style: 'narrow', type: 'unit' });
console.log(result3.format(gfg));
</script>
Output:
"Geeks1, Geeks2, Geeks3, और Geeks4" "Geeks1, Geeks2, Geeks3 या Geeks4" "Geeks1, Geeks2, Geeks3 Geeks4"
We have a complete list of Javascript Intl methods, to check those please go through the Javascript Intl Complete Reference article.
Supported Browsers: The browsers supported by Intl.ListFormat.prototype.format() method are listed below:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4