Tell us what’s happening:
palindrome(“1 eye for of 1 eye.”) should return false.
why it should ???
You’ll need to !!!remove!!! all non-alphanumeric characters (punctuation, !!!spaces!!! and symbols) and turn everything into the same case (lower or upper case) in order to check for palindromes.
Your code so far
function palindrome(str) {
let filtred = str.toLowerCase().split('').filter(a=>a.charCodeAt(0)>96&&a.charCodeAt(0)<123).join('');
console.log(filtred);
return filtred.split('').reverse().join('') == filtred;
}
palindrome("eye");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker