Why my code doesn't work in palindrome checker?

I’m trying to do the code for detecting palindromes, in this challenge

and my code is too similar of the solution 1, but doesn’t work in palindrome("five|_/|four");

function palindrome(str) {
  let str1= str.replace(/[\W_]/g, "").toLowerCase();
  if (str1 === str1.split("").reverse().join(""));
  return true;


Your function always returns true, because you do nothing with that if statement, you just terminate it with a semicolon.

Maybe check again how if statements are written:

if (condition to check) {
    // do stuff
} else {
    // do other stuff

your lfunction always returns true or undefined

maybe, instead of being the condition, you could use yourcomparison in a different way

what a silly thing I have left! thanks a lot!

I mean, return str1 === str1... is also a good way, it’s also more compact

i think so, when it work! Thanks!