odin-javascript-exercises/repeatString/repeatString.js
2017-12-15 12:56:14 -06:00

10 lines
201 B
JavaScript

var 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