Skip to content

Instantly share code, notes, and snippets.

@MarcelloDiSimone
Last active July 11, 2025 23:27
Show Gist options
  • Save MarcelloDiSimone/dc8cf1b4757b9bb9d9e6214dc4d06f5f to your computer and use it in GitHub Desktop.
Save MarcelloDiSimone/dc8cf1b4757b9bb9d9e6214dc4d06f5f to your computer and use it in GitHub Desktop.
overengineered rot13
function rot13(message){
return [...message].map((c) => (n = c.charCodeAt(0),String.fromCharCode(n >= 65 && n <= 90?((n - 65 + 13) % 26) + 65:(n >= 97 && n <= 122 ? (n - 97 + 13) % 26 + 97 : n)))).join('');
}
console.log(rot13('§""§$§Ruby is cool!')); // "grfg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment