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

11 lines
227 B
JavaScript
Raw Normal View History

2017-11-20 19:51:01 +00:00
var repeatString = function(string, num) {
if (num < 0) return 'ERROR'
let returnValue = ''
for(let i = 0; i < num; i++) {
returnValue = returnValue + string
}
return returnValue
2017-08-21 15:28:29 +00:00
}
module.exports = repeatString