Error in checks

Tell us what’s happening:
Describe your issue in detail here.
One of the checks as specified in the screenshot is a palindrome but as per the checklist it should return false which is incorrect.

image

  **Your code so far**

function palindrome(str) {
let p = str.trim().toLowerCase().replace(/\s|_|\d|\W/g, "")
console.log(p)
let temp = "";
for(let i=p.length-1;i>=0;i--) {
  temp += p[i];
}
console.log(temp)

if(temp === p) {
  return true;
} else {
  return false;
}

}

palindrome("1 eye for of 1 eye.")

console.log(palindrome("eye"));
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13816.82.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.218 Safari/537.36

Challenge: Palindrome Checker

Link to the challenge:

This is not a palindrome if you keep all alphanumeric characters :wink:

It worked thanks for that :blush:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.