Created
August 7, 2022 18:22
-
-
Save terremoth/f73ca0a61db6bf294730d30a8de689e2 to your computer and use it in GitHub Desktop.
remove prohibited chars from string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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