The resolvedOptions()
method of Intl.ListFormat instances
returns a new object with properties reflecting the locale and style formatting
options computed during the construction of this Intl.ListFormat
object.
Syntax
resolvedOptions()
Parameters
None.
Return value
An object with properties reflecting the locale and formatting options computed during the construction of the given Intl.ListFormat object.
Description
The object returned by resolvedOptions()
has the following properties:
locale
- : The BCP 47 language tag for the locale actually used. If any Unicode extension
values were requested in the input BCP 47 language tag that led to this locale,
the key-value pairs that were requested and are supported for this locale are
included in
locale
.
- : The BCP 47 language tag for the locale actually used. If any Unicode extension
values were requested in the input BCP 47 language tag that led to this locale,
the key-value pairs that were requested and are supported for this locale are
included in
style
- : The value provided for this property in the
options
argument of the constructor or the default value ("long"
). Its value is either"long"
,"short"
, or"narrow"
.
- : The value provided for this property in the
type
- : The value provided for this property in the
options
argument of the constructor or the default value ("conjunction"
). Its value is either"conjunction"
,"disjunction"
, or"unit"
.
- : The value provided for this property in the
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)