: 스트링을 split(value) value 단위로 끊어서 각각의 스트링을 배열에 정리해줌
_The split() method divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array. The division is done by searching for a pattern; where the pattern is provided as the first parameter in the method's call.
const str = 'Hi, my name is Hyunsoo'; const split = str.split(''); console.log(split) //output : [ 'Hi,', 'my', 'name', 'is', 'Hyunsoo' ]
The substr()method returns a portion of the string, starting at the specified index and extending for a given number of characters afterwards.
s = 'abcde' const x = s.substr(3, 2); console.log(x); // output : de
s = 'abcde' const x = s.length; // 5 const y = s.substr(x/2, 2); // 인덱스 2부터 2개의 문자를 반환 : cd