[JS beginner] Understand String Immutability

Tell us what’s happening:
Hey guys! I am stuck here with this challenge, I followed the example the instruction gave but it keeps telling me. I am not sure what I did wrong.
Just starting to learn JS…already be intimidated so much :joy: Would be really appreciate if anyone could help me out!

Cannot assign to read only property ‘0’ of string ‘Hello World’

Your code so far


// Setup
var myStr = "Jello World";

// Only change code below this line
var myStr = "Jello World";
myStr = "Hello World";
myStr[0] = "H"; // Fix Me



Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:

They purposely mislead you sometimes, because in the real world sometimes the bugs are silly mistakes.

Ok. So strings are immutable. That just means they can never be changed, ever. If you want to change a string, you have to rewrite it.

There are ways to split the text, change a letter, and recreate a string. But for now they just want you to change it manually.

Any questions you have just post them. I lurk here pretty often and will usually answer fairly quickly. Welcome to the wacky world of coding!