Call Us : +91-8376986802 (Viber, WhatsApp)

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



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

var days = [“Sunday”,”Monday”,”Tuesday”,”Wednesday”, “Thursday”,”Friday”,”Saturday”];
document.write(“days:”+days.join(“,”));

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

Leave a Reply