// join an array together into a string
// array for the .join() method
let numbers = [3, 1, 6]
let string = numbers.join(', ') // returns '3, 1, 6'
// Also works the same just for an array of STRINGS
const array = [0, 1, 2, 3, 4, 5];
/*
Array.prototype.join(separator);
Converts each element of the array into a string
and joins each element into one long string with
each element separated by the separator.
*/
const string1 = array.join("");
console.log(string1); // -> 012345
const string2 = array.join(",");
console.log(string2); // -> 0,1,2,3,4,5
const string3 = array.join(", ");
console.log(string3); // -> 0, 1, 2, 3, 4, 5
//The join() method also joins all array elements into a string.
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.join(" * ");
// result : Banana * Orange * Apple * Mango
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)