[JavaScript] Strip accents from a string

Published on 2019-01-06 • Modified on 2019-01-06

This one is very useful because it allows you to do accent insensitive searches on the user input. It allows to have the same results if the user types the accents or not.


function stripAccents(str) {
    return str.normalize('NFD').replace(/[\u0300-\u036f]/g, "");
}

 More on Stackoverflow