Forum : How to use join() to create a string from an array using JavaScript?
Brief description  about Online courses   join in Online courses
View Abhijit  Paul 's Profile

How to use join() to create a string from an array using JavaScript?

Hi sir,

How to use join() to create a string from an array using JavaScript.
Asked by Abhijit Paul | Nov 23, 2009 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Abhijit,


"join" concatenates the array elements with a specified seperator between them.

Here is an example :

<script type="text/javascript">
var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];
document.write("days:"+days.join(","));
</script>

This produces
days:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
Nov 23, 2009