mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix(curriculum): clarify that replace() returns a new string in JS lesson (#61730)
Some checks failed
i18n - Build Validation / Validate i18n Builds (22) (push) Has been cancelled
CI - Node.js / Lint (22) (push) Has been cancelled
CI - Node.js / Build (22) (push) Has been cancelled
CI - Node.js / Test (22) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (22) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 22) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 22) (push) Has been cancelled
i18n - Download Client UI / Client (push) Has been cancelled
CD - Docker - DOCR Cleanup Container Images / Delete Old Images (learn-api, dev) (push) Has been cancelled
CD - Docker - DOCR Cleanup Container Images / Delete Old Images (learn-api, org) (push) Has been cancelled
Some checks failed
i18n - Build Validation / Validate i18n Builds (22) (push) Has been cancelled
CI - Node.js / Lint (22) (push) Has been cancelled
CI - Node.js / Build (22) (push) Has been cancelled
CI - Node.js / Test (22) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (22) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 22) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 22) (push) Has been cancelled
i18n - Download Client UI / Client (push) Has been cancelled
CD - Docker - DOCR Cleanup Container Images / Delete Old Images (learn-api, dev) (push) Has been cancelled
CD - Docker - DOCR Cleanup Container Images / Delete Old Images (learn-api, org) (push) Has been cancelled
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Co-authored-by: Ilenia M <nethleen@gmail.com>
This commit is contained in:
parent
7c25ffc556
commit
1cca628c54
@ -11,7 +11,7 @@ In JavaScript, there are many scenarios where you may need to replace a portion
|
||||
|
||||
For instance, you might need to update user information in a URL, change the formatting of dates, or correct errors in user-generated content.
|
||||
|
||||
The `replace()` method in JavaScript allows you to find a specified value (like a word or character) in a string and replace it with another value.
|
||||
The `replace()` method in JavaScript allows you to find a specified value (like a word or character) in a string and replace it with another value. The method returns a new string with the replacement and leaves the original unchanged because JavaScript strings are immutable.
|
||||
|
||||
Here is the basic syntax:
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ const text = "HELLO, WORLD!"
|
||||
console.log(text.toLowerCase()); // "hello, world!"
|
||||
```
|
||||
|
||||
- **The `replace()` Method**: This method is used to find a specified value (like a word or character) in a string and replace it with another value.
|
||||
- **The `replace()` Method**: This method allows you to find a specified value (like a word or character) in a string and replace it with another value. The method returns a new string with the replacement and leaves the original unchanged because JavaScript strings are immutable.
|
||||
|
||||
```js
|
||||
const text = "I like cats";
|
||||
|
||||
@ -300,7 +300,7 @@ const text = "HELLO, WORLD!"
|
||||
console.log(text.toLowerCase()); // "hello, world!"
|
||||
```
|
||||
|
||||
- **The `replace()` Method**: This method is used to find a specified value (like a word or character) in a string and replace it with another value.
|
||||
- **The `replace()` Method**: This method allows you to find a specified value (like a word or character) in a string and replace it with another value. The method returns a new string with the replacement and leaves the original unchanged because JavaScript strings are immutable.
|
||||
|
||||
```js
|
||||
const text = "I like cats";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user