toString() – String Representation of Array
array.toString()
array
is an array of elementstoString
is the array method name
toString()
method returns string representation of the given array. the string contains the elements of the array separated by comma
Examples
1. convert the array fruits
to string, and print the string to console
let fruits = ['apple', 'banana', 'cherry', 'mango'];
let output = fruits.toString();
console.log(output);