Tell us what’s happening:
Hi,
I’m a little confused about one of the tests for the palindrome algorithm. Why should palindrome(“1 eye for of 1 eye.”) be returning false? After removing all non-letter characters this sentence is a palindrome. My code returned true for this string. Am I missing something?
Thanks!
Your code so far
function palindrome(str) {
var isPali = true;
var newStr = str.toLowerCase().replace(/([^a-z])*/g, "").split("");
for (var i=0; i<Math.floor(newStr.length/2); i++){
if (newStr[i] !== newStr[newStr.length-1-i]) isPali = false;
}
return isPali;
}```
**Your browser information:**
Your Browser User Agent is: ```Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36```.
**Link to the challenge:**
https://www.freecodecamp.org/challenges/check-for-palindromes