Skip to content

Commit f1b93ea

Browse files
committed
fixed the code to ensure no use of repeat was used by using "for"
1 parent f3d3d7c commit f1b93ea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎practice-tdd/repeat-str.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ export function repeatStr(str, count) {
44
if (count < 0) {
55
throw new Error("negative counts are not valid");
66
}
7-
return str.repeat(count);
7+
let result = "";
8+
for (let i = 0; i < count; i++) {
9+
result += str;
10+
}
11+
return result;
812
}

0 commit comments

Comments
 (0)