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

12 lines
220 B
JavaScript

const repeatString = function(text , num) {
if(num < 0) return "ERROR";
let res = "";
for(let i = 1 ;i <= num ; i++){
res += text;
}
return res;
};
// Do not edit below this line
module.exports = repeatString;