The toString method fuses the elements of an array into one character string, with a comma delimiter to separate the former elements.
Using the join method without specifying a delimiter will give you the same result.
Code:
<script type="text/javascript"> //<![CDATA[
myArray = new Array("a", "b", "c", "d", "e", "f"); for (i=0; i<myArray.length; i++) { document.write("myArray[", i, "] : ", myArray[i], "<br>"); } document.write("<br>myArray.toString() : ", myArray.toString(), "<br>"); document.write("<br>myArray.join() : ", myArray.join(), "<br>"); //]]> </script>
Output: