odin-default-js-exercises/repeatString/repeatString.js

12 lines
187 B
JavaScript

const repeatString = function(word, times) {
let arr = word.split(' ');
for (let i = 1; i < times; i++) {
arr.push(word);
}
return arr.join('');
}
module.exports = repeatString