parent
dd9a83068d
commit
9ae464672a
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue