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 d675e73 commit 31a753fCopy full SHA for 31a753f
1 file changed
Sprint-3/2-practice-tdd/repeat-str.js
@@ -1,5 +1,13 @@
1
-function repeatStr() {
2
- return "hellohellohello";
+function repeatStr(str, count) {
+ if (typeof str !== "string")
3
+ throw new Error("Please use a string i.e. 'Hello World'");
4
+
5
+ if (!Number.isInteger(count))
6
+ throw new Error("Please set count to an integer");
7
8
+ if (count < 0) throw new Error("Please use a count of 0 or greater");
9
10
+ return str.repeat(count);
11
}
12
13
module.exports = repeatStr;
0 commit comments