Turn a list like ["apples", "oranges", "pears"] into a localized sentence — “apples, oranges, and pears” in English, “manzanas, naranjas y peras” in Spanish, “りんご、オレンジ、梨” in Japanese — using the browser's built-in Intl.ListFormat. Pick a type (conjunction / disjunction / unit) and a style (long / short / narrow) and the formatter handles the connector words, Oxford comma rules, and per-locale spacing for you.
One item per line. Empty lines are dropped.
element · literal (locale-supplied separator / connector)
Same items, same type & style — how the locale changes the connector and punctuation.
| Locale | Formatted list |
|---|
Intl.ListFormat (ES2021) joins an array of strings with the connector and separator conventions of a given locale.
The three types are: conjunction (“A, B, and C”), disjunction
(“A, B, or C”), and unit (no final connector — “2 hr 30 min”).
The three styles are long, short (often a comma-only fallback), and narrow (most compact —
sometimes locale-specific punctuation). Use it to stop hand-rolling list-joining code that breaks the Oxford comma rule
or doesn't translate — the browser knows that French uses “et”, Japanese drops the connector entirely, and
Arabic right-to-justifies the separator.