문자열을 입력하였을때 .split 메소드를 통해 문자열을 나누는 기초적인 function을
만들고 싶었다.
function test1(str){
let test2 = str;
test2.split(' ');
return test2.split(' ');
}
let output = test1('kim yong hee');
console.log(output);
문자열이 나누어진 것을 확인 할 수 있었다.
또한 .split(''); 에서 ''사이를 띄우지 않으면
function test1(str){
let test2 = str;
test2.split('');
return test2.split('');
}
let output = test1('kim yong hee');
console.log(output);
모든 문자가 한문자씩 나누어 진 것을 확인 하였다.