Hello there, My problem is that the palindrome(“My age is 0, 0 si ega ym.”),palindrome(“_eye”) and palindrome(“almostomla”) aren’t returning what they are suppose to return. I cant find the solution to the problem, can anyone help?
**My code so far**
function palindrome(str) {
str = str.toLowerCase().replace(/\W_/g, '');;
for(let i = 0; i < str.length/2; i++){
if (str[i] !== str[str.length - 1 - i]){
return false;
} else {
return true;
}
}
}
palindrome("eye");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.30
Challenge: Palindrome Checker
Link to the challenge: