You are viewing a single comment's thread. Return to all comments →
//JavaScript Code:
function caesarCipher(s, k) {
k = k % 26; return s.split("").map((e) => { if (e.match(/^[a-zA-Z]+$/)) { let t = e.charCodeAt(0) > 90 ? 122 : 90; if (e.charCodeAt(0) > t - k && e.charCodeAt(0) <= t) return String.fromCharCode(e.charCodeAt(0) + k - 26); else return String.fromCharCode(e.charCodeAt(0) + k); } else return e; }).join("");
}
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →
//JavaScript Code:
function caesarCipher(s, k) {
}