Javascript

Topic: Js Array

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

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

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

This producesdays:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday

Browse random answers: