We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76de1ca commit 7323abaCopy full SHA for 7323aba
Sprint-3/2-practice-tdd/repeat.js
@@ -1,5 +1,16 @@
1
function repeat() {
2
- return "hellohellohello";
+ const str = arguments[0];
3
+ const count = arguments[1];
4
+ if (count < 0) {
5
+ throw new Error("Count must be a non-negative integer");
6
+ }
7
+ let result = "";
8
+ for (let i = 0; i < count; i++) {
9
+ result += str;
10
11
+ return result;
12
}
13
14
module.exports = repeat;
15
+
16
+console.log(repeat("hello", 3));
0 commit comments