How to read object from array, or what I'm doing wrong?
Here is my array map with object as key:
var nj = new RegExp("nj","g");
var replaceMap = {nj:"ň"};
But while looping the array I can't get valid object reference.
for (var replaceValue in replaceMap) {
text = text.replace(replaceValue, replaceMap[replaceValue]);
}
When replace is performing then it replaces only one instance of search text - RegExp object modifier for global match ("g") is ignored. I suppose, that I didn't get a valid object reference in replaceValue. When I used nj variable replace operation then it works fine.
Thanks in advance.