Basic JavaScript - Understand String Immutability

Tell us what’s happening:
Describe your issue in detail here.
My code is exact according to the guideline but it is not passed
Your code so far

// Setup
let myStr = "Jello World";

// Only change code below this line
myStr[0] = "H"; // Change this line

let myStr = "Jello World";
myStr = "Hello World";
// Only change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic JavaScript - Understand String Immutability

Link to the challenge:

You haven’t quite followed the instructions correctly. You should change the line which is commented as such, rather than adding your own lines of code. You have also declared the variable twice.

You didnt pay attention to the comments in the code

As said in the first comment, you are adding line of code which is not what you need to do. I would reset the lesson and ONLY change the line of code it says in the code given. It looks like you can correctly reassign the myStr variable, but you added unnecessary code

Now, I would reset all code?

If I were you I would reset the challenge, and only change the line as the comments tell you to do. Do not add an unnecessary code like you originally did. reassign the variable, but only on the line they tell you

Alright, i am reset it.

Great, now where the comment says “only change this line” That is the only place you want to make changes. Not above that line, or below that line but just that line. I know you can reassign the variable just fine so you should be able to pass this time.

after reset if i change H to Hello World i again no passed

Can you show us your new code so we can see what you did?


By using myStr[0] you are targeting only the first letter of a string. You need to change the entire variable. So to do that you need to remove [0] and only use myStr. I have included an example if you are not able to solve it


myStr = "new text";

thankyou so much sir. it worked.

1 Like