Skip to content

Instantly share code, notes, and snippets.

@terremoth
Created August 7, 2022 18:22
Show Gist options
  • Save terremoth/f73ca0a61db6bf294730d30a8de689e2 to your computer and use it in GitHub Desktop.
Save terremoth/f73ca0a61db6bf294730d30a8de689e2 to your computer and use it in GitHub Desktop.
remove prohibited chars from string
function newName(name) {
return name.toLowerCase().split('').map((char) => {
if(['e','r','t','y','u','i','a','s','k','l','b','n','m'].find(prohibited => prohibited === char)) {
return null;
}
return char;
}).join('');
}
console.log(newName("joãozinho da silva sauro"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment