i have a text replacing function below,
function msgConstructor(type, language, withUserName, userName) {
var txtAndPayloadType = {}
switch (language) {
case Enums.DeviceLanguages.tr:
txtAndPayloadType = Dictionary.tr.notifications[type]
break;
case Enums.DeviceLanguages.en:
default:
txtAndPayloadType = Dictionary.en.notifications[type]
break;
}
txtAndPayloadType.text = txtAndPayloadType.text.replace('[userName]', userName).replace('[withUserName]', withUserName)
return txtAndPayloadType;
}
I am getting the value from Dictionary to a seperate var but somehow .replace call on it's text effects the value in Dictionary. I think this has something to do with prototype level. How can i really copy the value from Dictionary to a new var?