Last active
August 18, 2025 13:21
-
-
Save Santiael/4c6bec1781d5ed0c15d450ffc39fb291 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
invertPhrase = (phrase) => { | |
const characters = [...`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!,.()"`]; | |
const invertedCharacters = [...`ɐqɔpǝⅎƃɥᴉɾʞʅɯuodbɹsʇnʌʍxʎz∀ꓭϽᗡƎᖵ⅁HIᒋꓘ⅂ꟽNOԀꝹꓤSꓕՈɅϺX⅄Z0⇂↊↋ߤ59𝘓86¿¡ʻ.)(﮼`]; | |
const phraseArray = [...phrase]; | |
const invertedPhrase = phraseArray.reduce((acc, cur) => { | |
const index = characters.indexOf(cur); | |
if(index < 0) return cur + acc; | |
return invertedCharacters[index] + acc; | |
}, ""); | |
return invertedPhrase; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment