Is it possible to replace the a character at a particular position with a string
Let us say there is say a string : "I am a man"
I want to replace character at 7 with the string "wom" (regardless of what the original character was).
The final result should be : "I am a woman"
Strings are immutable in Javascript – you can’t modify them “in place”.
You’ll need to cut the original string up, and return a new string made out of all of the pieces:
NB: I didn’t add this to
String.prototypebecause on some browsers performance is very bad if you add functions to theprototypeof built-in types.