diff --git a/02_repeatString/repeatString.js b/02_repeatString/repeatString.js index 4359bbe..144f9ab 100644 --- a/02_repeatString/repeatString.js +++ b/02_repeatString/repeatString.js @@ -1,6 +1,13 @@ -const repeatString = function() { - +const repeatString = function(word, times) { + let result = ''; + for (let i = 0; i < times; i++) { + result += word; + } + return result; }; +// Test the repeatString function +const repeatedWord = repeatString('apple', 3); +console.log(repeatedWord); // Output: "appleappleapple" // Do not edit below this line module.exports = repeatString;