Tell us what’s happening:
Please why are this not being marked as correct;
1…palindrome("_eye")
should return true
.
2… palindrome("0_0 (: /-\ :) 0-0")
should return true
.
Your code so far
function palindrome(str) {
str = str
.toLowerCase()
.replace(/[\W+]/g, '');
let newStr = str.split("");
let output = newStr
.reverse()
.join("");
if(str == output){
return true;
}else{
return false;
}
}
palindrome("eye");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.52
Challenge: JavaScript Algorithms and Data Structures Projects - Palindrome Checker
Link to the challenge: