JavaScript Algorithms and Data Structures Projects - Palindrome Checker

this is my code so far but it’s does not work. Any assistance??

function palindrome(str) {
  const cleanedStr = str.replace(/[^a-zA-Z]/g, '').toLowerCase();

  const reverseWord = cleanedStr.split('').reverse().join("");

  if(cleanedStr ===reverseWord){
    return true
  }else{
    return false
  }

}

console.log(palindrome('eye'));

Your browser information:

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

Challenge Information:

JavaScript Algorithms and Data Structures Projects - Palindrome Checker

Take another look at the requirements which characters should be kept in string.

1 Like