0
A random offset replace function
Is there a function for replacing a substring from a certain position (not from the beginning) in Javascript ?
3 Answers
+ 2
You can use replace() it'll replace a substring with new string you provided
But if you want to replace a substring from certain index, you'll need to write the function yourself
its pretty simple, substring 0 to startindex, add the new string, add substring from endindex to end string
+ 1
Substring and substr can do that
First parameter is the offset
0
But I need to replace the substring