![Combine all items in an array into a string](https://javascriptsource.com/wp-content/uploads/2022/06/Combine-all-items-in-an-array-into-a-string-702x526.jpg)
Combine all items in an array into a string, separated by a delimiter that you can pass in as an argument. By default, it will use a comma (,
) as the delimiter if one is not provided.
var strings = [
'I love Cape Cod potato chips.',
'What about you?'
];
var concat = strings.join();
var concatWithSpace = strings.join(' ');
var concatWithSmiley = strings.join(' =) ');
// logs "I love Cape Cod potato chips.,What about you?"
console.log(concat);
// logs "I love Cape Cod potato chips. What about you?"
console.log(concatWithSpace);
// logs "I love Cape Cod potato chips. =) What about you?"
console.log(concatWithSmiley);