Getting Right answers but wrong feedback

Getting Right answers but wrong feedback
0.0 0

#1

Tell us what’s happening:
So my code returns the right things, but it’s saying that I got all the answers wrong. Any reason for this?

Your code so far

function rot13(str) { // LBH QVQ VG!
	var strArray = str.split(" ");
    var newStrArray = [];
	for (var i = 0; i<strArray.length ;i++) {
		for (var j = 0; j < strArray[i].length; j++) {
          newStrArray.push("");
			if (strArray[i].charCodeAt(j) > 64 && strArray[i].charCodeAt(j) < 78) {  
				newStrArray[i] += String.fromCharCode(strArray[i].charCodeAt(j) + 13);
			} else if (strArray[i].charCodeAt(j) >= 78 && strArray[i].charCodeAt(j) < 91) {
				newStrArray[i] += String.fromCharCode(strArray[i].charCodeAt(j)-13);
			} else {
				newStrArray[i] += strArray[i].charAt(j);
			}
		}
	}
	return newStrArray.join(" ");
}
// Change the inputs below to test
rot13("SERR CVMMN!");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:


#2

You are not getting the correct answers. Put the following before your return statement and you will figure out why your function is not returning the correct string.

console.log(newStrArray);

#3

Gotcha, I changed my approach completely and figured it out. Thank you!