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

Bharathi Cherukuri
Posted by Bharathi Cherukuri under JavaScript category on | Points: 40 | Views : 2050
"join" concatenates the array elements with a given specified seperator between them.

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

Comments or Responses

Posted by: Akiii on: 7/11/2012 Level:Bronze | Status: [Member] | Points: 10
This is an interesting thing......


Thanks and Regards
Akiii

Login to post response