Caesar Cipher

  • + 0 comments

    js single line code solution:

    const caesarCipher = (s, k) => (String.fromCodePoint(...[...s].map((char,idx,arr,currCodePoint)=>(currCodePoint = char.codePointAt(0),(currCodePoint<=90&&currCodePoint>=65)?(((currCodePoint + k)-65)%26+65):((currCodePoint<=122&&currCodePoint>=97)?(((currCodePoint + k)-97)%26+97):(currCodePoint))))));