Check for Palindromes fails in two places

Check for Palindromes fails in two places
0

#1

Tell us what’s happening:
I am failing in my check for palindromes in two places:
palindrome(“A man, a plan, a canal. Panama”) should return true.
and:
palindrome(“My age is 0, 0 si ega ym.”) should return true.
I have been unable to find the problem with these too. I need more sets of eyes
on it I think. Thanks in advance for any help, greatly appreciated.

Your code so far

function palindrome(str) {
  // Good luck!
  var strClean = str.replace(/[\W_]/gi, '');
  
  var strReverse = strClean.split("").reverse().join("");
  if(strClean==strReverse){
    return true;
  }
  else return false;
}



palindrome("eye");

Your browser information:

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

Link to the challenge:


#2

Make sure you convert the sentences to lowercase before you compare the two strings.