Skip to content

Commit 8ff02d3

Browse files
authored
Correct the code
1 parent b1c0345 commit 8ff02d3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
function repeat() {
2-
const str = arguments[0];
3-
const count = arguments[1];
1+
function repeat(str, count) {
42
if (count < 0) {
53
throw new Error("Count must be a non-negative integer");
64
}
5+
76
let result = "";
87
for (let i = 0; i < count; i++) {
98
result += str;
109
}
10+
1111
return result;
1212
}
1313

14-
1514
module.exports = repeat;
16-
console.log(repeat("hello", 3));
15+
16+
console.log(repeat("hello", 3));
1717

0 commit comments

Comments
 (0)