In this article, we will tell you how to convert an array to a string by join method using javascript(Javascript array to string by join() method). sometimes we need to array into a javascript string. we use commas, space, and pipe signs for the array to string.
Now, in the below following example, we will take an array and convert it into a javascript string. here, in the below following example, we use space delimited. so you can follow the below example.
<script>
var fruit = new Array();
fruit.push("Apple");
fruit.push("Mango");
fruit.push("Watermelon");
fruit.push("Orange");
fruit.push("Cherry");
fruit.push("Grape");
var fruitStr = fruit.join(" ");
console.log('Delimited String :- ' + fruitStr);
</script>