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 7198839 commit b91f950Copy full SHA for b91f950
Sprint-3/2-practice-tdd/repeat.js
@@ -1,10 +1,11 @@
1
-function repeat(str,count) {
2
-
3
- if(count<0){
4
- return "Error: negative numbers are not valid";
+function repeat(str, count) {
+ if (count < 0 || count === undefined || typeof count !== "number") {
+ return "Error : count must be a positive integer";
5
}
6
- return (str.repeat(count));
+ if (count === 0) {
+ return "";
7
+ }
8
+ return str.repeat(count);
9
10
11
module.exports = repeat;
0 commit comments