JAVASCRIPT

메서드 (charAt)

코빈_ 2022. 8. 22. 13:35

charAt()

지정한 인덱스의 문자를 추출하여, 문자열을 반환한다.

"문자열".charAt(숫자);

    const str1 ="javascript reference"
    const currentStr1 = str1.charAt();          // j
    const currentStr2 = str1.charAt("0");     // j
    const currentStr3 = str1.charAt("1");     // a
    const currentStr4 = str1.charAt("2");     // v