odin-javascript-exercises/02_repeatString/repeatString.js
2023-06-19 15:18:34 -07:00

16 lines
274 B
JavaScript

const repeatString = function (string, times) {
if (times < 0) {
return 'ERROR'
}
let result = ''
for (let i = 0; i < times; i++) {
result += string
}
return result
};
// Do not edit below this line
module.exports = repeatString;