Check for Palindromes(0)

Tell us what’s happening:
My function takes a string in as a parameter and returns true if it is a palindrome (a word which is read the same forward as backward). So far it returns true even if the parameter is not a palindrome. What have I done wrong?

Your code so far

function palindrome(str) 
{
  // Good luck!
  str.toLowerCase();
  str.replace(/ /, "");
  str.replace(/_/, "");
  var backStr = str.split();
  backStr.reverse();
  
  
  if(backStr.join("") === str)
    {
      return true;
    }
  
  else
    {
      return false;
    }
  
}


palindrome("nope");

Your browser information:

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

Link to the challenge:

Okay, I made the change but now I think I have a problem with the use of my use of the replace() functions. Am I doing this correctly?

Here’s the code:


function palindrome(str) 
{
  // Good luck!
  str = str.toLowerCase();
  str = str.replace(/ /, "");
  str = str.replace(/_/, "");
  str = str.replace(/,/, "");
  str = str.replace(/./, "");
  var backStr = str.split("");
  backStr.reverse();
  
  
  if(backStr.join("") === str)
    {
      return true;
    }
  
  else
    {
      return false;
    }
  
}


palindrome("nope");

It didn’t work. Also, none of the other replace() functions are working.

Oh! Thanks for your help