From 14076cbde01b0e56a409404b062cdcaa1049752b Mon Sep 17 00:00:00 2001 From: Tuukka Hastrup Date: Wed, 7 Sep 2022 20:35:41 +0300 Subject: [PATCH] fix(curriculum): Clarify understand-string-immutability (#47448) * Clarify understand-string-immutability Remove some misleading explanation (immutability is orthogonal to literals). * Remove extraneous whitespace Co-authored-by: Jeremy L Thompson * Improve explanation per review suggestion Co-authored-by: Jeremy L Thompson Co-authored-by: Jeremy L Thompson --- .../basic-javascript/understand-string-immutability.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 4a330b813a1..2564240ae8c 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -11,14 +11,14 @@ dashedName: understand-string-immutability In JavaScript, `String` values are immutable, which means that they cannot be altered once created. -For example, the following code: +For example, the following code will produce an error because the letter `B` in the string `Bob` cannot be changed to the letter `J`: ```js let myStr = "Bob"; myStr[0] = "J"; ``` -cannot change the value of `myStr` to `Job`, because the contents of `myStr` cannot be altered. Note that this does *not* mean that `myStr` cannot be changed, just that the individual characters of a string literal cannot be changed. The only way to change `myStr` would be to assign it with a new string, like this: +Note that this does *not* mean that `myStr` could not be re-assigned. The only way to change `myStr` would be to assign it with a new value, like this: ```js let myStr = "Bob";