My code is as follows:
array.forEach(el => {
string = string.replace(el, `censored`);
});
array : my array of words that I want to censor. string : the string that the words need censoring.
My issue is that this process is quite slow and also if the word in my string is written using capitals, it's getting missed. Any ideas how should I solve this issue? Thank you.