
str.split(separator, limit)
파라미터를 입력하지 않을 경우
const str = "행복해, 사랑해, 좋아해";
const result = str.split();
console.log(result);

단어별로 잘라서 배열에 담기
const str = "행복해 사랑해 좋아해";
const result = str.split(" ");
console.log(result);

글자별로 잘라서 배열에 담기
const str = "행복해, 사랑해, 좋아해";
const result = str.split("");
console.log(result);

쉼표를 기준으로 문자열을 분할하기
const str = "행복해, 사랑해, 좋아해";
const result = str.split(",");
console.log(result);

const str = "행복해,사랑해,좋아해"; // 띄어쓰기 x
const result = str.split(",");
console.log(result);

limit 값 지정하기
const str = "행복해, 사랑해, 좋아해";
const result = str.split(" ", 1);
console.log(result);
