Skip to content

Commit 5b52894

Browse files
committed
repeatStr function and tests
1 parent 03e9d2a commit 5b52894

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sprint-3/2-practice-tdd/repeat.js

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

5-
module.exports = repeat;
8+
module.exports = repeatStr;

0 commit comments

Comments
 (0)