function rot13(str) {
const letters = {
"A":"N",
"B":"O",
"C":"P",
"D":"Q",
"E":"R",
"F":"S",
"G":"T",
"H":"U",
"I":"V",
"J":"W",
"K":"X",
"L":"Y",
"M":"Z",
"N":"A",
"O":"B",
"P":"C",
"Q":"D",
"R":"E",
"S":"F",
"T":"G",
"U":"H",
"V":"I",
"W":"J",
"X":"K",
"Y":"L",
"Z":"M"
}
return str.replace(/([A-Z])/g, match => letters[match]);;
}
console.log(rot13("SERR PBQR PNZC"));
Two more to go 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?