Check for Palindromes 1eye

Check for Palindromes 1eye
0

#1

Tell us what’s happening:
Hi guys, can anybody help me? This code pass all the point except one “1 eye for of 1 eye.” Why this should return false?

Thanks for your help!

Your code so far

function reverseString(str){
    var strArray = str.split("");
    strArray = strArray.reverse();
    return strArray;

}

var n1 = -1;
function palindrome(str) {
    // Good luck!
    str = str.toLowerCase();
    str = str.replace(/[0-9]|[^a-z]|-|_|" "|","|"."/g, '');
    str= str.replace(/\s/g,'');
    console.log(str);
    var strReverse = reverseString(str);
    console.log(strReverse);
    console.log(str);
    strReverse = strReverse.join("");
    console.log(strReverse===str);
    return strReverse==str;
}

palindrome("race car123");



Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6.

Link to the challenge:


#2

Because “1eyeforof1eye” backwards is “eye1forofeye1”. Not a palindrome.