Check for Palindromes need help

Check for Palindromes need help
0

#1

Need help with this…don’t understand why special characters are not being removed??

function palindrome(str) {
// Good luck!
var myString = str.toLowerCase().replace(/[email protected]#$%^&*().,_/gi, “”);

var newString = myString.split(’’).reverse().join(’’);
if (myString == newString) {
return true;
}
else
return false;

}

palindrome(“eye”);


#2

Tour regex is wrong.
Use this one instead : /[^a-zA-Z0-9]/g

you can use regexr.com to play with regular expressions.


#3

Wow regexr.com was super helpful! Thanks I finished it!