Using Array.join() to Concatenate Array Elements in Javascript


Combine elements of an array into a string, optionally using a separator.

Source Code

let fruits = ['apple', 'banana', 'cherry'];
let result = fruits.join(', ');
console.log(result); // "apple, banana, cherry"
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments