diff --git a/curriculum/challenges/english/blocks/lecture-working-with-string-modification-methods/67326c3392068ec6184a0c95.md b/curriculum/challenges/english/blocks/lecture-working-with-string-modification-methods/67326c3392068ec6184a0c95.md index 0bfb95a0807..f60f9264756 100644 --- a/curriculum/challenges/english/blocks/lecture-working-with-string-modification-methods/67326c3392068ec6184a0c95.md +++ b/curriculum/challenges/english/blocks/lecture-working-with-string-modification-methods/67326c3392068ec6184a0c95.md @@ -75,6 +75,21 @@ The `repeat()` method can simplify tasks that involve string duplication, making Whether you're generating repeated text patterns or filling a space with characters, `repeat()` can save you from writing loops or more complex code. +You are not limited to passing a number directly into the `repeat()` method. You can also pass a variable that stores a number value. + +:::interactive_editor + +```js +let count = 4; +let word = "Test"; +let repeatedWord = word.repeat(count); +console.log(repeatedWord); // TestTestTestTest +``` + +::: + +In this example, the `count` variable stores the number of repetitions. This can be useful when the number of repetitions depends on user input or other dynamic values in your program. + # --questions-- ## --text--