Firefox Tomorrow

javascript instance method

Intl.ListFormat.prototype.resolvedOptions()

View on MDN ↗

The resolvedOptions() method of ListFormat instances returns a new object with properties reflecting the options computed during initialization of this ListFormat object.

Interactive exampleOpen the canonical MDN source to run this embedded demo.
const deListFormatter = new Intl.ListFormat("de-DE", { type: "disjunction" });
const options = deListFormatter.resolvedOptions();

console.log(options.locale);
// Expected output: "de-DE"

console.log(options.style);
// Expected output: "long"

console.log(options.type);
// Expected output: "disjunction"

Syntax

resolvedOptions()

Parameters

None.

Return value

A new object with properties reflecting the options computed during the initialization of this ListFormat object. The object has the following properties, in the order they are listed:

  • locale
  • type
    • : The value provided for this property in the options argument, with default filled in as needed. It is either "conjunction", "disjunction", or "unit". The default is "conjunction".
  • style
    • : The value provided for this property in the options argument, with default filled in as needed. It is either "long", "short", or "narrow". The default is "long".

Examples

Using resolvedOptions

const deListFormatter = new Intl.ListFormat("de-DE", { style: "short" });

const usedOptions = de.resolvedOptions();
console.log(usedOptions.locale); // "de-DE"
console.log(usedOptions.style); // "short"
console.log(usedOptions.type); // "conjunction" (the default value)

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also