본문 바로가기
JAVASCRIPT

메서드 (repeat)

by 코빈_ 2022. 8. 17.

repeat()

문자열을 복사하여, 복사한 새로운 문자열을 반환한다.

    const str1 = "javascript";
    const currentStr1 = str1.repeat(0);
    const currentStr2 = str1.repeat(1);     // javascript
    const currentStr3 = str1.repeat(2);     // javascriptjavascript

'JAVASCRIPT' 카테고리의 다른 글

메서드 (includes)  (2) 2022.08.18
메서드 (padStart / padEnd)  (2) 2022.08.17
메서드 (concat)  (2) 2022.08.17
메서드 (replace / replaceAll)  (2) 2022.08.17
메서드 (split)  (1) 2022.08.17

댓글


INFORMATION

javascript

css

html