rot13 cipher

Run Settings
LanguageJavaScript
Language Version
Run Command
let input = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; let output = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'; let encoded = '' let str = 'abcd' for(let i=0; i<str.length; i++) { const index = input.indexOf(str[i]) encoded += output[index] } console.log(encoded) const rot13 = str => str.split('') .map(char => String.fromCharCode( char.charCodeAt(0) + (char.toLowerCase() < 'n' ? 13 : -13))) .join("") x = rot13('abcd') console.log(x)
Editor Settings
Theme
Key bindings
Full width
Lines