Check for Palindromes Work

Check for Palindromes Work
0.0 0

#1

Tell us what’s happening:

Your code so far

function palindrome(str) {
  str = str.replace(/[\W_]/g, "");
    
  var reverseStr =str.toLowerCase().split("").reverse().join("");
  
  if(str === reverseStr) {
      return true;
  } else {
      return false;
  }

}

palindrome("eye");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0.

Link to the challenge:


#2

The code doesn’t run if the string begins with an upper case


#3

Which test is it failing on?
You could try this if(str.toLowerCase() === reverseStr) {


#4

i converted the string to lower case before calling the replace method and it worked