Hi,
I’m stuck and do not know why. I suppose you have heard this before.
Here is my loooong solution, did it this way to get my head around it.
function palindrome(str) {
var removeSpecialChar = str.replace(/[^A-Za-z]/g, ""); //the caret shows what is allowed
var lowCase = removeSpecialChar.toLowerCase(); //long ways to follow the logic for bugs
var splitChar = lowCase.split('');
var revChar = splitChar.reverse();
var joinIt = revChar.join('');
return joinIt === lowCase;
}
palindrome("eye");
It works on all 12 other tests, except for one sentence
palindrome("1 eye for of 1 eye.") should return false.
I test it on repl.it and it works there
Any ideas why?