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

14 lines
290 B
JavaScript

const repeatString = function(string, num) {
if( num > 0 ){
let repeated = string.repeat(num);
return repeated;
} else if( num === 0 ){
return "";
}else if ( num < 0 ){
return "ERROR";
}
};
// Do not edit below this line
module.exports = repeatString;