Javascript String replacer(replaceObject)
String.prototype.replacer = function(replaceObject) { let replaceString = this; let regex;/*from ww w .j a v a 2 s . c o m*/ for(let key in replaceObject) { regex = new RegExp(key, "g"); replaceString = replaceString.replace(regex, replaceObject[key]); } return replaceString; };