Copy and paste to the console:
String.prototype.replaceMap = function(parameters) {
var string = this.toString();
Object.keys(parameters).forEach(function(key){
string = string.replace(new RegExp(key, 'g'), parameters[key]);
});
return string;
}
"hello world".replaceMap({
" ": ", ",
"wor": "it's",
"ld": " me"
});