Tell us what’s happening:
I don’t understand why FreeCodeCamp says the result of this "1 eye for of 1 eye."
should return False
function palindrome(str) {
//console.log(str)
let minuscula= str.toLowerCase()
//console.log(minuscula)
const flag=/[a-z]/g
let arr1= minuscula.match(flag)
let word1="";
let word2="";
if(arr1== null){
return true
} else{
for(let i=0; i<arr1.length; i++){
word1 += arr1[i]
}
console.log(word1)
for(let i= arr1.length-1; i>=0; i--){
word2 +=arr1[i]
}
console.log(word2)
if(word1 === word2){
return true
}else{
return false
}
}
}
console.log(palindrome("1 eye for of 1 eye."))
Challenge: Palindrome Checker
Link to the challenge: