본문 바로가기
JAVASCRIPT

메서드 (charAt)

by 코빈_ 2022. 8. 22.

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

'JAVASCRIPT' 카테고리의 다른 글

요소 크기 속성 및 메서드  (6) 2022.09.01
함수 유형  (5) 2022.08.22
메서드 (match)  (3) 2022.08.22
메서드 (search)  (3) 2022.08.22
메서드 (trim / trimStart / trimEnd)  (2) 2022.08.18

댓글


INFORMATION

javascript

css

html