Created
September 12, 2018 21:28
-
-
Save akey7/5abcc62edad715a0a3a42e1616e3a138 to your computer and use it in GitHub Desktop.
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
const hs3 = (orig, replacements = {'a': '4', 'e': '3', 'i': '1', 'o': '0'}) => ( | |
Object | |
.entries(replacements) | |
.reduce((acc, el) => acc.replace(el[0], el[1]), orig) | |
) | |
console.log(hs3('life')) | |
console.log(hs3('air')) | |
console.log(hs3('none')) | |
console.log(hs3('javascript')) |
Comments are disabled for this gist.