With the help of toString() method we can get a string value that contains the entire elements of an array, each separated via a comma.
Note: this method won’t change the content of the original array, however.
Array toString() Syntax:
Array toString() Method Parameters:
This method does not take an argument.
Array toString() Method Return Value:
The return value of this method is a string value that contains all the elements of the target array, each separated by a comma.
const arr = ["John Doe", "Omid Dehghan"]; console.log(arr.toString());
John Doe,Omid Dehghan
const arr = [1,2,3,4,5,6,7,8,9]; console.log(arr.toString());