Skip to content

Commit da301ec

Browse files
authored
Update repeat-str.js
1 parent 0ff0585 commit da301ec

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function repeatStr() {
22
// Your implementation of this function must *not* call String.prototype.repeat (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat).
33
// The goal is to re-implement that function, not to use it.
4-
return str.repeat(count);
4+
return Array.from({ length: count }, () => str).join("");
55
}
66

77
module.exports = repeatStr;

0 commit comments

Comments
 (0)