Tell us what’s happening:
I know I have a issue when I try to filter the correct characeter. I think my regex expresion is right but I don’t know if regex isn’t compatible with filter or something.
I’m missing something and I not sure what it is…
Your code so far
function palindrome(str) {
let myFilter = str.split("").filter((i) => i == /[a-z]/gi )
console.log(myFilter);
let strFilter = myFilter.join("").toLowerCase();
let myReverse = myFilter.reverse().join("").toLowerCase();
if (strFilter == myReverse) {
return true
}
return false;
}
palindrome("A man, a plan, a canal. Panama");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker