To replace all occurrences of a string we can use the
Here is an example, which replaces all occurrences of an
ola in the following string.
const str = "how ola are ola you ola"; // (search , replacement) const replaced = str.replace(/ola/gi, ""); console.log(replaced);
how are you