Convert array into string in javascript

<script>
var courses = ["javascript", "php", "angularjs", "node js"];
/// toString() is used to convert array into string
document.write(courses.toString());
//// You also can use join method
document.write(courses.join(","));
//// You also can use valueOf method
document.write(courses.valueOf(","));
</script>

Share This: