diff --git a/repeatString/repeatString.js b/repeatString/repeatString.js index 1d462e2..0107520 100644 --- a/repeatString/repeatString.js +++ b/repeatString/repeatString.js @@ -1,9 +1,12 @@ const repeatString = function(word, times) { let arr = []; - - - for (let i = 0; i < times; i++) { - arr.push(word); + + if (times < 0) { + return 'ERROR'; + } else { + for (let i = 0; i < times; i++) { + arr.push(word); + } } return arr.join('');