toString() Function is used to join all the elements of the Array into a String.
Let us say, we have a Array that contains four names, Mohan, Kriti, Philip and Salim. And we want to convert the Array elements into a String.
<html> <body> <script> var x = ["Mohan", "Kriti", "Philip", "Salim"] var y = x.toString() document.write(y) </script> </body> </html>
So, we have an Array that has 4 names.
So, all we have done is, used the join() method to convert the elements of the array into a string.
var y = x.toString()