There is a way to ““deaccent” the string being compared” without the use of a substitution function that lists all the accents you want to remove…
Here is the easiest solution I can think about to remove accents (and other diacritics) from a string.
See it in action:
var string = 'Ça été Mičić. ÀÉÏÓÛ';
console.log(string);
var string_norm = string.normalize('NFD').replace(/\p{Diacritic}/gu, ''); // Old method: .replace(/[\u0300-\u036f]/g, "");
console.log(string_norm);
.normalize(…)decomposes the letters and diacritics..replace(…)removes all the diacritics.