Find and Replace Substring in Javascript
Β· β 1 min read
Find and replace substring within a string using replace.
If you know the exact substring use it directly in replace and be at peace.
1 2 3 let sample = "Lorem ipsum dolor sit amet ..."; sample = sample.replace("ipsum", "gypsum"); console.log("sample: ", sample); // Lorem gypsum dolor sit amet .