Understand String Immutability 2018

Understand String Immutability 2018


Tell us what’s happening:
What am I doing wrong?

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";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0.

Link to the challenge:



You don’t need to retype the var myStr = “Jello World”;
The var is already defined bellow //Setup.
What you need to do is just fix the myStr so it reapplies a new value, the “Hello World” that its asked to the myStr.
And you don’t need to use the bracket notation.


var is used to define something, once it is defined you can simply reference it with its name myStr.

For your problem, it has already been defined in the setup.

The error with the code, the one you are trying to fix, is that they are trying to use bracket notation to target the first character of the string. This is wrong, as it is not a array.

This is string immutability, showing you to change a string it must be redefined, like with:

myStr = "Hello World";