Understand String Immutability bugged?

Understand String Immutability bugged?
0

#1

Tell us what’s happening:
I can’t get this to pass

Your code so far

// Setup
var myStr = "Jello World";

// Only change code below this line

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; CrOS x86_64 9460.73.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.134 Safari/537.36.

Link to the challenge:


#2

JavaScript doesn’t allow modifying individual characters in a string directly (the same is true for a couple other languages).

What you can do is to reassign the myStr variable a different string. When reassigning, there’s no need to use the var keyword.

So the bug that you’re describing is in your own code, not in the challenge itself :wink: