fix(curriculum): add missing content replaceAll() in JS strings review (#63895)

This commit is contained in:
Diem-Trang Pham 2025-11-17 03:51:48 -06:00 committed by GitHub
parent e0d21f30c9
commit 0029c51a9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,6 +104,13 @@ console.log(text.toLowerCase()); // "hello, world!"
const text = "I like cats";
console.log(text.replace("cats", "dogs")); // "I like dogs"
```
- **The `replaceAll()` Method**: This method allows you to find all occurrences of a specified value (a word, character, or pattern) in a string and replace them with another value. It works like replace(), but instead of stopping after the first match, it updates every match found in the string.
```js
const text = "I love cats and cats are so much fun!";
console.log(text.replaceAll("cats", "dogs")); // "I love dogs and dogs are so much fun!"
```
- **The `repeat()` Method**: This method is used to repeat a string a specified number of times.