Skip to content

Commit 4b42131

Browse files
committed
corrected condition rule to include NaN and Infinity numbers
1 parent 06a987e commit 4b42131

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function repeat(str, count) {
2-
if (typeof count !== "number" || isNaN(count) || count < 0) {
2+
if (!Number.isInteger(count) || count < 0) {
33
throw new Error("Count must be a valid number");
44
}
55
return str.repeat(count);

0 commit comments

Comments
 (0)