Skip to content

Commit b9967fa

Browse files
committed
refactor function repeatStr()
1 parent d09a54e commit b9967fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function repeatStr(str, count) {
2-
if (count >= 0) return str.repeat(count);
3-
else throw new Error("Invalid format: count cannot be");
2+
if (count < 0) throw new Error("Invalid format: count cannot be negative");
3+
return str.repeat(count);
44
}
55

66
module.exports = repeatStr;

0 commit comments

Comments
 (0)