Skip to content

Commit dc0f3f7

Browse files
committed
fix the repeat-str
1 parent 292dd0f commit dc0f3f7

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
function repeatStr(n, str) {
2-
return str.repeat(n);
3-
}
1+
function repeatStr(str, count) {
2+
if (count < 0) {
3+
throw new Error("Count cannot be negative");
4+
}
45

5-
module.exports = repeatStr;
6+
return str.repeat(count);
7+
}

0 commit comments

Comments
 (0)