fix(curriculum): update string method lesson to include variable usage example (#66229)

This commit is contained in:
Ayantunji Timilehin
2026-03-04 11:29:21 +01:00
committed by GitHub
parent 3888a601ad
commit b8ae304f76
@@ -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--