str.split and arr.join

Let names = 'Bilbo, Gandalf, Nazgul';
let arr = names.split(', ');

for (let name of arr) {
  alert( `A message to ${name}.` ); // A message to Bilbo  (and other names)
}
Let arr = ['Bilbo', 'Gandalf', 'Nazgul'];
let str = arr.join(';');
alert( str ); // Bilbo;Gandalf;Nazgul

The str.split(delim) method splits the string into an array by the given delimiter delim.

Related concepts

str.split and arr.join

str.split and arr.join — Structure map

Clickable & Draggable!

str.split and arr.join — Related pages: