Palindrome enigma

Tell us what’s happening:
my code works for every condition except this -->> palindrome(“1 eye for of 1 eye.”)
can anyone explain to me why this is ? palindrome(“1 eye for of 1 eye.”) seems like a palindrome to me. Any help would be greatly appreciated.

   **Your code so far**

function returnAlphabet(word){ //this function filters out all the non-alphanumeric characters

var emptyArr=[];
var regEX = /[a-z]/
for(var i =0;i<word.length;i++){
return emptyArr

function fisrtLetter(word){ //extracts first letter of word
 return word.slice(0,1)

function lastLetter(word){ return word.slice(-1)}// etracts last letter of word

function middleWords(word){ return word.slice(1,-1)} //extracts middle letters

function realPalindrome(word){ // palindrome algorithm
  if (word.length<=1){ 
    return true

    return false
   return realPalindrome(middleWords(word))


function palindrome(str) {

var filteredWord = returnAlphabet(str).join('')

return realPalindrome(filteredWord)

   **Your browser information:**

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

Challenge: Palindrome Checker

Link to the challenge:

“1 eye for of 1 eye” stripped of non-alphanumerics is “1eyeforof1eye”. Backwards that’s “eye1forofeye1”, which is different.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.