The toLocaleString method in JavaScript serves the purpose of transforming the items within a specified array into a string format, with each of these strings being delineated by a comma ",".
Syntax:
Example
array.toLocalString();
Parameters:
No parameters.
Return value:
It provides a string that represents the components of the array.
Browser Support:
| Chrome | Yes |
|---|---|
| Safari | Yes |
| Firefox | Yes |
| Opera | Yes |
Example
JavaScript TypedArray toLocaleString Method.
Example
<script>
//JavaScript to illustrate toLocalString() method
var A = "Example";
var B = "Core Java";
// C is an array containing elements of above variables
var C = [A,B];
// Calling toLocalString() method
var isMore= C.toLocaleString();
// Printing string
document.write(isMore);
// expected output:Example,Core Java
</script>
Output:
Output
Example,Core Java