I have a string, let\'s say Hello world and I need to replace the char at index 3. How can I replace a char by specifying a index?
Hello world
var str = \"h
You can't. Take the characters before and after the position and concat into a new string:
var s = "Hello world"; var index = 3; s = s.substring(0, index) + 'x' + s.substring(index + 1);