From 1cca628c541ca1bdb65d7a9fb501cf91b5089189 Mon Sep 17 00:00:00 2001 From: Niloy Saha Date: Sun, 24 Aug 2025 00:19:20 +0600 Subject: [PATCH] fix(curriculum): clarify that replace() returns a new string in JS lesson (#61730) Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Co-authored-by: Ilenia M --- .../67326c29dcd98fc5ecc49779.md | 2 +- .../review-javascript-strings/6723c1946e4cd7909a836bb4.md | 2 +- .../review-javascript/6723d3cfdd0717d3f1bf27e3.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/lecture-working-with-string-modification-methods/67326c29dcd98fc5ecc49779.md b/curriculum/challenges/english/25-front-end-development/lecture-working-with-string-modification-methods/67326c29dcd98fc5ecc49779.md index 04b9c8ceabd..de3c3880471 100644 --- a/curriculum/challenges/english/25-front-end-development/lecture-working-with-string-modification-methods/67326c29dcd98fc5ecc49779.md +++ b/curriculum/challenges/english/25-front-end-development/lecture-working-with-string-modification-methods/67326c29dcd98fc5ecc49779.md @@ -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: diff --git a/curriculum/challenges/english/25-front-end-development/review-javascript-strings/6723c1946e4cd7909a836bb4.md b/curriculum/challenges/english/25-front-end-development/review-javascript-strings/6723c1946e4cd7909a836bb4.md index 68c46065a59..7017b867041 100644 --- a/curriculum/challenges/english/25-front-end-development/review-javascript-strings/6723c1946e4cd7909a836bb4.md +++ b/curriculum/challenges/english/25-front-end-development/review-javascript-strings/6723c1946e4cd7909a836bb4.md @@ -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"; diff --git a/curriculum/challenges/english/25-front-end-development/review-javascript/6723d3cfdd0717d3f1bf27e3.md b/curriculum/challenges/english/25-front-end-development/review-javascript/6723d3cfdd0717d3f1bf27e3.md index db89c57b1dc..7a2e27957d3 100644 --- a/curriculum/challenges/english/25-front-end-development/review-javascript/6723d3cfdd0717d3f1bf27e3.md +++ b/curriculum/challenges/english/25-front-end-development/review-javascript/6723d3cfdd0717d3f1bf27e3.md @@ -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";