Mega Code Archive

 
Categories / JavaScript Tutorial / Array
 

Array join()

Syntax array.join()     array.join(string) The join() method converts all the elements to strings and then concatenates all the strings into a longer string. If an argument is provided in the parameter list, it is used to separate the elements in the string returned by the method. <html>     <script language="JavaScript">     <!--     fruit = new Array("A","B","C");     aString = fruit.join("-");       document.write("The fruit array contains: ",aString);     -->     </script> </html>