Help me with this.
function palindrome(str) {
// Good luck!
str.toLowerCase()
str = str.replace(/[\W_]/g,'');
var str2 = ""
for (let i = str.length; i > 0; i--) {
str2 = str2 + str.slice(i - 1, i)
}
if (str2 == str.toLowerCase()) {
return true;
} else {
return false;
}
}
palindrome("OKy")
palindrome("eye");
Browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0.
These test cases are not working;
palindrome(“A man, a plan, a canal. Panama”) should return true.
palindrome(“My age is 0, 0 si ega ym.”) should return true