String.prototype.replaceMap = function (data) {
var result = this;
for (var i in data)
if (data.hasOwnProperty(i))
result = result.replace(new RegExp(i, "gi"), data[i]);
return result;
};
var a = "абв";
a = a.replaceMap({
"а" : "1",
"б" : "2",
"в" : "3"
});
alert(a);