How can i solve :Understand String Immutability

Tell us what’s happening:

Your code so far


// Setup
var myStr = "Jello World";

// Only change code below this line

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

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability/

Take a look at the 2nd example given in the instructions.

var myStr = "Bob";
myStr = "Job";

You want to follow this format. Basically you just have to get rid of middle 2 lines.

You need to change this line
Whatever you add later is not accepted because as first thing this line has wrong syntax
And if you fix this you don’t need the following lines

You also shouldn’t declare (using var) a variable that is already declared like you did here:

1 Like