I want to replace all characters, except the characters that exist in an array, in a string with * .
let myArr = ['a', 'f', 'g'];
string.replace(all characters except the ones existing in myArr, '*');
Is this somehow possible with plain javascript?
If not how about a variable?
let myLetter = 'b';
string,replace(all characters except myLetter, '*');