Palindrome Checker Question

Tell us what’s happening:
the criteria I am missing is
````palindrome(“not a palindrome”)should return false.palindrome(“nope”)should return false.palindrome(“nope”)should return false.palindrome(“1 eye for of 1 eye.”)should return false.palindrome(“five|_/|four”)` should return false.
everything else I have checked.Can someone explain what I am missing please?```

Your code so far


function palindrome(str) {
  // Good luck!
let characters = str.replace(/[\W_-]/g, '');
let order = characters.toLowerCase().split('').reverse().join(''); 

if (str = characters){
  return true;
}
else {
  return false;
}

}


palindrome("eye");

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker/

If you want to keep the same code you wrote more or less than you have to change three things:

  1. The way you check for equality is incorrect
  2. You need to lowercase the value in first holder variable dont expect to lowercase the value in second variable, it will never be equal if there are capital letters stored in your first variable
  3. You are checking the wrong variables in your if block

If you fix these three things you will pass

you are not using the comparison operator here,
a variable assignment is always truthy, so it always return true

note also that you don’t need an if/else statement of you just want to return true or false with a simple condition, just return the condition

// example 
if (x > 10) { return true} else { return false}

// you could just do 
return x > 10

Thank you guys, your help is appreciated.