Skip to content

Is there a way to combine all elements in an array?

So I’m making a website, and I want to string together all the items in an array. e.g:

function combineArray {
const myArray = [text1, text2, text3];
//code to output text1text2text3 here

Does anyone know how to do this?


join will join all elements in the array with the specified delimiter (use empty string '' since the default separator is comma ,)

const myArray = ["a", "b", "c"];
const res = myArray.join('');