string
-
[Javascript] 문자열 함수언어/Javascript 2022. 6. 8. 22:53
문자열. 말 그대로 '문자의 나열'을 뜻한다 문자열에서 개개의 문자에 접근할 수 있는 방법 두가지 const str = "cat" console.log(str.charAt(1)); // output => "a" console.log(str[1]); // output => "a" toLowerCase : 영어를 모두 소문자로 변환해준다 ( ↔ toUpperCase : 대문자로 변환) const str = "ABCDabcd"; console.log(str.toLowerCase()); // output => "abcdabcd" startsWith와 endsWith : 문자열의 앞 또는 뒤에 내가 찾는 문자열이 있는지 여부를 알려준다 (boolean) const str = "abcdefghijklmnopqrst..