Thanks for this series!
In mentioning the immutability of strings, it's probably also worth mentioning for the newbies that the alternative is you just reassign the value of the variable in small tasks where you won't need the original value again (and if you need to keep the original value, you assign the new value to a new variable):
let faveQ = "The Marathon Continues";
faveQ
"The Marathon Continues"
faveQ = faveQ.slice(4);
"Marathon Continues"
faveQ
"Marathon Continues"
So, in my case above, it kinda looks like you could be mutating the string (and simply editing the text), but you're really reassigning a new string to the variable.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for this series!
In mentioning the immutability of strings, it's probably also worth mentioning for the newbies that the alternative is you just reassign the value of the variable in small tasks where you won't need the original value again (and if you need to keep the original value, you assign the new value to a new variable):
let faveQ = "The Marathon Continues";
faveQ
"The Marathon Continues"
faveQ = faveQ.slice(4);
"Marathon Continues"
faveQ
"Marathon Continues"
So, in my case above, it kinda looks like you could be mutating the string (and simply editing the text), but you're really reassigning a new string to the variable.