Need help looking at this challenge

Need help looking at this challenge
0

#1

Tell us what’s happening:

Not sure what I could be missing here?

Your code so far

function palindrome(str) {
  // Good luck!
  if (str.replace(/[\W_]/g, '').toLowerCase ===
      str.replace(/[\W_]/g, '').toLowerCase.split('').reverse().join('')) {
    return true;
  } else {
    return false;
  }
}
 
 



palindrome("eye");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36.

Link to the challenge:


#2

In order to have the returned letter in lower case you actually have to call the toLowerCase function, instead of accessing its prototype.

Or in practice use .toLowerCase() instead of toLowerCase.

str.replace(/[\W_]/g, '').toLowerCase()  // and not str.replace(/[\W_]/g, '').toLowerCase

#3

Ah…missed that. Thanks @Marmiz