String Immutability (i coudnt advance even tho i did every thing accordingly!)

Tell us what’s happening:
Correct the assignment to myStr so it contains the string value of Hello World using the approach shown in the example above.

Your code so far
// Setup
var myStr = “Jello World”;

// Only change code below this line

myStr[0] = “H”; // Change this line
// Only change code above this line
var myStr = “Hello World”;


// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "H"; // Change this line
// Only change code above this line
var 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/83.0.4103.97 Safari/537.36.

Challenge: Understand String Immutability

Link to the challenge:

Hello~!

This line is throwing an error, and the challenge asks you to change this line so it properly reassigns the value of the variable myStr. :slight_smile:

1 Like

the error is because of var myStr = “Jello World”;
but i changed mystr with
myStr=“Hello World”;

so when it corrected and when the index is called it should display H right?

console.log(myStr[0]) would print “H” to the console, yes.
But myStr[0] = "H" is still an invalid assignment expression. :slight_smile:

yes nice prespective thankkyou.
it worked