Caesars Cipher_

function rot13(str) {

  const letters = {
  return str.replace(/([A-Z])/g, match => letters[match]);;

console.log(rot13("SERR PBQR PNZC"));

Two more to go :sob: So far why does it feel like the last 5 are easier than the previous section lol…maybe I am just getting better

But anyways, I was able to complete this one quickly but I still feel like there’s a more efficient way to do this without taking up so many lines. Does anyone know solutions that are more concise than this?

We have blurred this solution (with [spoiler][/spoiler] tags) so that users who have not completed this challenge can read the discussion in this thread without giving away the solution.

There is a possibility you could loop through ascii codes for the relevant letter, along with the offset for the code letter using modulus to make sure it doesnt go over. Using String.fromCharCode, you can get the letter for the number. I dont know much shorter is would make it, but you should save a few lines

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.