Help. I’ve since looked at the solutions to this challenge and feel competent with the necessary tools such as .replace and .toLowerCase, however I cannot for the life of me figure out why my original code won’t work! Any help is appreciated. The only test case it fails on is: "palindrome(“1 eye for of 1 eye.”)
it solves all of the other test cases correctly. Any help is appreciated. Thanks in advance!
function palindrome(str) {
var manipulative = str;
manipulative = manipulative.replace(/\W+/gi,’’);
manipulative = manipulative.replace(/\d+/gi,’’);
manipulative = manipulative.replace(/(_)/g,’’);
manipulative = manipulative.toLowerCase();
var forward = manipulative.split(’’);
var strForward = forward.join(’’);
var backward = forward.reverse();
var strBackward = backward.join(’’);
if (strBackward === strForward) {
return true;
}
else {
return false;
}
}