Palindrome Test

Tell us what’s happening:
Describe your issue in detail here.
Can someone please help me. I dont see whats wrong with my code

  **Your code so far**

function palindrome(str) {
let newStr = str.toLowercase().replace(/[^a-z\d]/g, '');
return newStr.split('').reverse().join('') === newStr;
}


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

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36

Challenge: Palindrome Checker

Link to the challenge:

You’re not getting this error in your console window?

TypeError: str.toLowercase is not a function

I’m always forgetting details about the prototype methods. The MDN site is a great resource. I would google “mdn string tolowercase” and see if that helps.

When I fix that, your code passes for me.

Thanks I see the error

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