formatArray()function
formatArray(arr: ImmutableArray<unknown>, options?: ArrayFormatOptions, caller: AnyCaller = formatArray): string
| Param | Type | |
|---|---|---|
arr | ImmutableArray<unknown> | Array of values to format. required |
options | ArrayFormatOptions | Formatting options passed through to Intl.ListFormat. |
caller | AnyCaller | Function to attribute a thrown error to (defaults to formatArray itself). Defaults to formatArray |
| Return | |
|---|---|
string | Locale-formatted list string with each item converted via formatValue(). |
Format an unknown array as a string.
Examples
formatArray(["a", "b", "c"]) // "a, b, and c"