I am not sure what’s wrong with my code. I couldn’t find any similar codes to mine when I looked through the forum, so I create new topic.
My code passes all the tests except :
-
palindrome("_eye")
-
palindrome(“0_0 (: /-\
0-0”)
**Your code so far**
function palindrome(str) {
var strNormal = str.slice().replace(/[\W]/g, "").toLowerCase();
var strRev = strNormal.split("").reverse().join("");
if (strNormal === strRev) {
return true
} else {
return false
}
}
palindrome("eye");
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
.
Challenge: Palindrome Checker
Link to the challenge: