js replace with code example
Example 1: str replace javascript all
str.replace(/abc/g, '');
Example 2: replace all javascript
str.split(search).join(replacement);
Example 3: replace javascript
let randomtext = "Random text yo!"
let textRegex = /yo!/;
randomtext.replace(textRegex, "is here.");
console.log(randomtext.replace(textRegex, "is here."));
// Returns Random text is here.