loading...

re: Daily Challenge #42 - Caesar Cipher VIEW POST

FULL DISCUSSION
 

My solution in js

const encode = (sentence, key) => sentence.split(' ')
                                          .map((word) => word.split('')
                                          .map((char) => (/[a-z]/i.test(char)) ? String.fromCharCode(char.charCodeAt(0) + key) : char)
                                          .join(''))
                                          .join(' ');
code of conduct - report abuse