The toLocaleString() method returns a string representing the elements of the array. The elements are converted to Strings using their toLocaleString methods and these Strings are separated by a locale-specific String (such as a comma ",").

Try it


toLocaleString(locales, options);


locales Optional

A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the locales argument, see the Intl page.

options Optional

An object with configuration properties. For numbers, see Number.prototype.toLocaleString(); for dates, see Date.prototype.toLocaleString().

Return value

A string representing the elements of the array.


The Array.prototype.toLocaleString method traverses its content, calling the toLocaleString method of every element with the locales and options parameters provided, and concatenates them with a implementation-defined separator (such as a comma ","). Note that the method itself does not consume the two parameters — it only passes them to the toLocaleString() of each element. The choice of the separator string depends on the host's current locale, not the locales parameter.


Using locales and options

The elements of the array are converted to strings using their toLocaleString methods.

Always display the currency for the strings and numbers in the prices array:

const prices = ['¥7', 500, 8123, 12];
prices.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' });

// "¥7,¥500,¥8,123,¥12"

For more examples, see also the Intl, NumberFormat, and DateTimeFormat pages.


ECMAScript Language Specification
# sec-array.prototype.tolocalestring
ECMAScript Internationalization API Specification
# sup-array.prototype.tolocalestring

Browser compatibility

BCD tables only load in the browser

See also