toLocaleString() method returns a string representing the elements of the array in a particular locale.
syntax ↴
toLocaleString(locales, options) ↴
locales (optional). A string with a BCP 47 language tag, or an array of such strings.
If this parameter is not provided, the host environment's current locale will be used.
options (optional). An object with configuration properties.
The current locale is based on the language settings of the browser.
toLocaleString() method when used on sparse arrays iterates empty slots as if they have the value undefined.
If a locale identifier is not a string or an object, TypeError is thrown.
If a locale identifier is a string that's syntactically invalid, RangeError is thrown.
myArray.toLocaleString()
myArray.toLocaleString(locales)
myArray.toLocaleString(locales, options)