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 ca4e87b commit 75c15afCopy full SHA for 75c15af
Sprint-3/2-practice-tdd/repeat-str.js
@@ -1,9 +1,5 @@
1
function repeatStr(str, count) {
2
- if (count === 0) {
3
- return "";
4
- } else if (count === 1) {
5
- return str;
6
- } else if (count > 1) {
+ if (count >= 0) {
7
return str.repeat(count);
8
} else {
9
throw new Error("Count cannot be a negative number");
0 commit comments