TypedArray toLocaleString() JavaScript

The Javascript TypedArray toLocaleString() method transforms the elements of an array into a locale-specific string. All elements of the array will be separated by a comma (,).

Syntax:

array.toLocaleString()

Parameters:
total: It represents the previously returned value of the function.
currentValue: It represents the index position of the current element.
index: It represents the index position of the current element.
arr: It represents the array.
thisValue: It represents this argument for the function.

Returns:
It returns the string.

Example 1:

<!DOCTYPE html>
<html>
<body>
<script>  
var num = ["HELLO",32,34,"WORLD",83];    
document.write(num.toLocaleString());  
</script>
</body>
</html>

Example 2:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript"> 
var uint = new Uint32Array([343, 34, 12, 45, 6767]);
 
document.write(uint.toLocaleString());
document.write("</br>");
document.write(uint.toLocaleString('en-US'));
document.write("</br>");
document.write(uint.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' }));
 
</script>
</body>
</html>