ListFormat Types: Conjunction, Disjunction, and Unit
You'll learn how to control whether lists use "and," "or," or unit-style formatting.
What Are ListFormat Types?
When formatting lists with Intl.ListFormat, the type option determines the grammatical relationship between items. Think of it like choosing the glue word that connects list elements: are you joining things together (conjunction), offering alternatives (disjunction), or listing units of measurement (unit)?
The Three Types
Conjunction (Default)
Use type: 'conjunction' for "and" lists—items that belong together:
const andList = new Intl.ListFormat('en', { type: 'conjunction' });
console.log(andList.format(['apples', 'oranges', 'bananas']));
// → "apples, oranges, and bananas"
Disjunction
Use type: 'disjunction' for "or" lists—alternatives or choices:
const orList = new Intl.ListFormat('en', { type: 'disjunction' });
console.log(orList.format(['red', 'green', 'blue']));
// → "red, green, or blue"
Unit
Use type: 'unit' for measurements or related quantities where you want minimal connectors:
const unitList = new Intl.ListFormat('en', { type: 'unit' });
console.log(unitList.format(['5 pounds', '12 ounces']));
// → "5 pounds, 12 ounces" (no "and")
Locale Awareness
Different languages handle these connectors differently. Spanish uses "y" for conjunction, "o" for disjunction:
const spanishAnd = new Intl.ListFormat('es', { type: 'conjunction' });
console.log(spanishAnd.format(['manzanas', 'naranjas']));
// → "manzanas y naranjas"
Key Takeaway: The type option controls list semantics—use conjunction for "and" lists, disjunction for "or" lists, and unit for measurement-style lists without explicit connectors.