Understand String Immutability - Hello World

Tell us what’s happening:

I don’t seem to know how to pass this code. From the instruction, making ‘myStr’ into
“Hello World” would work since I should rewrite it (which I’ve done) so I’m not sure why it is not working!

Your code so far

// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "H"; // Fix Me
myStr = "Hello World";

Your browser information:

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

Link to the challenge:

1 Like

so you still have the code that is trying to replace myStr[0], which will throw an error. You’re doing exactly the right thing, simply assigning an entirely new string to the variable, but you need to remove the line that is, still, throwing an error.

1 Like

I have the same problem…should I remove the line with myStr[0]? actually did it and it worked :wink: thx

1 Like

lol I was about to paste the link to this conversation in the thread you’d started, but you’ve deleted it.

Before posting a question (and not to discourage questions, just suggesting a route to consider), try searching the forums for solutions to your question. Often, they’ve been answered. often, they’ve been answered MANY times. Use that magnifying glass in the menu bar, type in a few keywords, and save yourself the frustration. :wink:

1 Like

that’s good to know. thank you

1 Like

Interesting, that worked, thanks!!

1 Like