I am trying to replace different set characters with corresponding values. for example every < to be replaced with a #U34 and every $ to replaced with )#89.
I have an array of strings that have those characters randomly thrown about. for example:
var arr = [
'uisdhfu<',
'u$$fd<'
]
so far I figured out that i can do:
var replace = /</ig;
var newString = textWithCharacters.replace(replace, '#U34');
but this seems like it can only be done for one character at a time. and if i want to do more than one I seems like i need to create a new string each time. is there a way to do this in one go? maybe with a loop and if statements? but i can't seem to figure out how i would define the conditions of the loop.