Skip to content

Commit d83cfa4

Browse files
committed
Implemented repeatStr function
1 parent 3372770 commit d83cfa4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
function repeatStr() {
2-
return "hellohellohello";
1+
function repeatStr(str,count) {
2+
if (count < 0) {
3+
throw new Error("Count must be a non-negative");
4+
}
5+
return str.repeat(count);
36
}
47

58
module.exports = repeatStr;

0 commit comments

Comments
 (0)