Think you have string like this in a variable.
let string = “hello my name is hello”
Now you want to replace all “hello” with “something”. To that you can use this way in js.
string = string.split(“hello”).join(“something”);
This will do the trick for you. Thank you for reading.