Hey all. I’m having trouble with the cipher challenge. Could someone please explain where I’m going wrong in this code (probably everywhere) and how I can make it better
the for loop is where I’m messing up I believe, tell me also if you think my filter function is constructed properly or not
function rot13(str) { // LBH QVQ VG! var answer = []; str.split(''); function cipher (letter) { if (letter === /[^0-9a-z]/gi) { return; } else if (letter.charCodeAt >= 77) { letter.toCharCode(65 + (13 - (50 - letter.charCodeAt))); } else{ letter.toCharCode(letter.charCodeAt + 13); } } for (i=0; i<str.length; i++) { i.filter(cipher); answer.push(i); } return answer.push(); } // Change the inputs below to test rot13("SERR PBQR PNZC");