728x90
repeat( )
문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환합니다.
"문자열".replace(찾을 문자열, 변경할 문자열)
"문자열".replace(정규식)
"문자열".replace(정규식, 변경할 문자열)
const str1 = "javascript";
const currentStr1 = str1.repeat(0); // 아무것도 나오지 않는다.
const currentStr2 = str1.repeat(1); // javascript
const currentStr3 = str1.repeat(2); // javascriptjavascript
728x90
반응형
'JavaScript' 카테고리의 다른 글
includes( ) (3) | 2022.08.17 |
---|---|
padStart( ) | padEnd( ) (3) | 2022.08.17 |
replace() | replaceAll() (2) | 2022.08.17 |
split() (2) | 2022.08.17 |
template (2) | 2022.08.17 |
댓글