odin-javascript-exercises/02_repeatString/solution/repeatString-solution.js
2022-02-20 14:07:44 -05:00

10 lines
224 B
JavaScript

const repeatString = function (word, times) {
if (times < 0) return 'ERROR';
let string = '';
for (let i = 0; i < times; i++) {
string += word;
}
return string;
};
module.exports = repeatString;