반응형 repeat()1 repeat() 문자열 메서드 : repeat() repeat() / repeatAll() 메서드는 문자열을 복사하여, 복사한 새로운 문자열을 반환합니다. 그 패턴은 문자열이나 정규식(RegExp)이 될 수 있으며, 교체 문자열은 문자열이나 모든 매치에 대해서 호출된 함수일 수 있습니다. pattern이 문자열 인 경우, 첫 번째 문자열만 치환이 되며 원래 문자열은 변경되지 않습니다. const str1 = "javascript"; const currentStr1 = str1.repeat(0); //'' const currentStr2 = str1.repeat(1); //javascript const currentStr3 = str1.repeat(2); //javascriptjavascript repeat() 예제 Ra.. 2022. 8. 17. 이전 1 다음 반응형