Skip to content

Commit 4ad048f

Browse files
committed
Implemented repeat function
1 parent 6f7984a commit 4ad048f

File tree

1 file changed

+8
-3
lines changed
  • Sprint-3/3-mandatory-practice/implement

1 file changed

+8
-3
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
function repeat() {
2-
return "hellohellohello";
1+
function repeat(str, count) {
2+
if (count < 0) {
3+
return "Negative numbers are not valid!";
4+
} else {
5+
return str.repeat(count);
6+
}
37
}
48

5-
module.exports = repeat;
9+
console.log(repeat("hello", 10));
10+
module.exports = repeat;

0 commit comments

Comments
 (0)