Understand String Immutability SOS

Understand String Immutability SOS
0

#1

Tell us what’s happening:

Why is the code still marked wrong even though it was accepted? I do not understand the errors or if this was just a bug?

Your code so far

// Setup
var myStr = "Jello World";

// Only change code below this line

myStr ="Hello World";
myStr[0];

Your browser information:

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

Link to the challenge:


#2

hello camper, you should remove this line “myStr[0];” and re-run the code. It should work perfectly.


#3

Just throwing myStr[0]; on a random line is invalid JS, it does nothing, that’s why you’re getting an error.