A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/javascript-typedarray-tolocalestring-method/ below:

JavaScript typedArray.toLocaleString() Method - GeeksforGeeks

JavaScript typedArray.toLocaleString() Method

Last Updated : 12 Jul, 2025

The typedArray.toLocaleString() method is used to convert the elements to strings of an array. The elements converted to strings are separated by a comma (' , '). This method follows the same algorithm as of the Array.prototype.toLocaleString() and if the elements are numbers then it follows the same algorithm as Number.prototype.toLocaleString().

Syntax:

typedarray.toLocaleString( locales, options );

Parameters: This method accepts two parameters as mentioned above and described below:

Return value: This method returns a string that represents the element of the typedArray. 

The below examples illustrate the typedArray.toLocaleString() method in JavaScript: 

Example 1: In this example, we will convert the elements of the array into string values using the typedArray.toLocaleString() method in JavaScript.

javascript
<script>
    var geek = new Uint32Array([100, 897, 123, 132, 22]);
    
    console.log(geek.toLocaleString()); 
    
    console.log(geek.toLocaleString('en-US'));
    
    console.log(geek.toLocaleString('hi', 
        { style: 'currency', currency: 'HIR' }));
</script>

Output:

"100, 897, 123, 132, 22"
"100, 897, 123, 132, 22"
"HIR 100.00, HIR 897.00, HIR 123.00, HIR 132.00, HIR 22.00"

Example 2: In this example, we will convert the elements of the array into string values using the typedArray.toLocaleString() method in JavaScript.

javascript
<script>
    var A = " GeeksforGeeks ";
    var B = " JavaScript ";
    var C = " Array.prototype.toLocaleString() ";
    var D = [A, B, C];
    var result= D.toLocaleString();
    console.log(result);
</script>

Output:

 " GeeksforGeeks, JavaScript, Array.prototype.toLocaleString() "

Supported Browsers: The browsers supported by typedArray.toLocaleString() method are listed below:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4