'문자열'.repeat(횟수) : 횟수만큼 문자열을 곱한다.
var str = 'hello';
var answer = str.repeat(3);
console.log(answer); // hellohellohello
'JavaScript' 카테고리의 다른 글
[JavaScript] forEach((element, index) => {}) (0) | 2023.08.03 |
---|---|
[Javascript] 배열의 최대값, 최소값 구하기 / Math.max(), Math.min() (0) | 2023.08.02 |
[Javascript] 아스키코드 활용하기 / '문자'.codePointAt(), String.fromCodePoint('숫자') (0) | 2023.08.02 |
[Javascript] 거듭제곱, 제곱근 구하기 / Math.pow(), Math.sqrt() (0) | 2023.08.02 |
[Javascript] 문자열 치환하기 / replace(), 정규식 (0) | 2023.08.02 |