array into string code example
Example 1: join last element of array javascript with different value
['tom', 'dick', 'harry'].join(', ').replace(/, ([^,]*)$/, ' and $1')
> "tom, dick and harry"
Example 2: .join javascript
const elements = ['Fire', 'Air', 'Water'];
console.log(elements.join());
console.log(elements.join(''));
console.log(elements.join('-'));
Example 3: javascript join array
var array = ["Joe", "Kevin", "Peter"];
array.join();
array.join("-");
array.join("");
array.join(". ");
Example 4: can you do a join() in js without the commas
arr.join("")
Example 5: array to string javascript
<array>.join(<splitting character(s)>);
Example 6: js join
const elements = ['Fire', 'Air', 'Water'];
console.log(elements.join());
console.log(elements.join(''));
console.log(elements.join('-'));