📜

Repeat String

Repeat String
쉬움 문자열 +10pts

Problem

Write a function that repeats a string n times.

Examples

Input: repeatString("ab", 3)
Output: "ababab"

Explanation

이 문제는 **repeat() 메서드**를 사용하여 문자열을 반복하는 방법을 학습합니다. ## 핵심 개념: 문자열 반복 repeat()은 문자열을 지정된 횟수만큼 반복하여 새 문자열을 만듭니다. ### 기본 사용법 ```javascript str.repeat(count) ``` - count: 반복 횟수 (0 이상의 정수) - 0이면 빈 문자열 반환 - 음수나 Infinity면 오류 발생 ### 활용 예시 ```javascript "ab".repeat(3) // "ababab" "*".repeat(5) /...

View detailed explanation →

Key Concepts

repeat 메서드 문자열 반복 ES6 메서드 패턴 생성
Time: O(n*m) Space: O(n*m)
solution.js
Ctrl + Enter
Run tests to see results here.