const color = 'red, blue, green';
let a = color.split(',');
console.log(a); // ['red','blue','green']
a = color.split(',',2); //limit 2
console.log(a); // ['red','blue']
a = color.split(); //구분자 x
console.log(a); // ['red, blue, green']
const color = ['red','blue','green'];
let a = color.join(); //구분자 x, default 콤마(,)
console.log(a); // red,blue,green
a = color.join('');
console.log(a); // redbluegreen
a = color.join(' ');
console.log(a); // red blue green
a = color.join(' and ');
console.log(a); // red and blue and green
Reference: 코드스테이츠