Once you assign a string that string can not be changed in memory.
you can access i any charachter of it separately :
myStr[1] = e
but you can not changed it because it can not be changed in the memory it is preserved .
It’s pretty clearly explained in the challenge description I believe.
The following code:
> var myStr = "Bob";
> myStr[0] = "J";
Contents, meaning individual elements (in this case = characters of the string) can’t be changed.
That’s what immutability is - you can’t modify the parts of it. Let’s take a loot at an object:
const myObject = {
name: `aziztareq295`
}
Objects can be mutated. You can go ahead and write myObject.name = "New Name". It’s still going to be the same object, but its content (name property) will be changed to “New Name”.
Which brings me to the 2nd point:
2. While you can’t mutate a variable containing a string, you can assign it a completely new value.
Like this:
var myString = "This is my string!" // declaration
myString[1] = "G"
// ^^ trying to mutate(change the second letter). This won't work. myString is still "This is my string!"
myString = "This is a new string!"
// ^^ new value is assigned to myString. myString is now "This is a new string!"