Hi im stuck on the cesars cipher problem and not sure how to proceed. I can get the characters to decode but they are in the wrong order. When there are more one letter inputted to the string it add the 2nd character the beginning instead of the end.
function rot13(str) {
const cipher = {
'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'
}
let newArr = str.split('')
let testString= []
for (let [key, value] of Object.entries(cipher)) {
for(let i = 0; i < newArr.length; i++){
if(newArr[i] == key){
testString += value
console.log(testString)
}
}
}
}
console.log(rot13("AB"));