Return to Kroll Design home page

JavaScript Tutorials

 
« Return

join method for arrays

The join method fuses the elements of an array into one character string, with the specified delimiter character to separate elements.
If you specify no delimiter character, a comma is used.
If you want no delimiter to show, specify a delimiter of double quote: "".

Code:

<script type="text/javascript">
//<![CDATA[
array1 = new Array("G", "l", "o", "r", "i", "a"); joinedString1 = array1.join(); document.write(joinedString1, "<br>"); joinedString2 = array1.join("-"); document.write(joinedString2, "<br>"); joinedString3 = array1.join(""); document.write(joinedString3, "<br>"); //]]> </script>

Output:



 
« Return


©2012 Kroll Design    info@KrollDesign.net    781.910.3694
Last modified: 12/31/1969 7:00 PM