var res = str.replace("find", "replace");
var str = "Mr Blue has a blue house and a blue car"; var res = str.replace(/blue/g, "red");
var str = "Visit Microsoft!"; var res = str.replace("Microsoft", "W3Schools"); console.log(res); /*Result Visit W3Schools! */
let string = 'soandso, my name is soandso'; let replaced = string.replace(/soandso/gi, 'Dylan'); console.log(replaced); //Dylan, my name is Dylan