I am trying to set the value of a character at a certain index in a string with a new character and I was wondering if it was possible with charAt() method. Something like this. str.charAt(1)
will return string "e" at first.
let str = "hello";
str.charAt(1) = 'a';
str.charAt(1)
will then return string "a".
My expected result is that the new string reads "hallo". But this results in an Uncaught ReferenceError: Invalid left-hand side in assignment. So is it simply not possible with this method?