Skip to content

Commit 75c15af

Browse files
committed
simplyfying the code by using the repeat methodand making
1 parent ca4e87b commit 75c15af

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
function repeatStr(str, count) {
2-
if (count === 0) {
3-
return "";
4-
} else if (count === 1) {
5-
return str;
6-
} else if (count > 1) {
2+
if (count >= 0) {
73
return str.repeat(count);
84
} else {
95
throw new Error("Count cannot be a negative number");

0 commit comments

Comments
 (0)