The toLocaleString() method returns a string representing the elements of the typed array. The elements are converted to strings and are separated by a locale-specific string (such as a comma “,”). This method has the same algorithm as Array.prototype.toLocaleString() and, as the typed array elements are numbers, the same algorithm as Number.prototype.toLocaleString() applies for each element. TypedArray is one of the typed array types here.


typedarray.toLocaleString([locales [, options]]);


The locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. In implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent.

See the Intl.NumberFormat() constructor for details on these parameters and how to use them.

Return value

A string representing the elements of the typed array.


Using toLocaleString

var uint = new Uint32Array([2000, 500, 8123, 12, 4212]);

// if run in a de-DE locale
// "2.000,500,8.123,12,4.212"

// "2,000,500,8,123,12,4,212"

uint.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' });
// "¥2,000,¥500,¥8,123,¥12,¥4,212"


ECMAScript (ECMA-262)
The definition of 'TypedArray.prototype.toLocaleString' in that specification.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
toLocaleStringChrome Full support 7Edge Full support 12Firefox Full support 51IE Full support 10Opera Full support 11.6Safari Full support 5.1WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 51Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android Full support 1.0nodejs Full support 0.10


Full support  
Full support

See also