Check for Palindromes - eyeforofeye

Tell us what’s happening:

Your code so far

function palindrome(str) {
  //string interpolating uses special single quotes and ${variable}
  console.log(`^\n : ${str}`);

  //get rid of special characters
  let s = str.replace(/[^a-zA-Z ]/g, "");
  //remove spaces 
  s = s.replace(/\s/g, '');
  let sl = s.toLowerCase();
  console.log(`   compare : ${sl}`);
  //string to array 
  let a = sl.split("");
  //reverse the array
  let r = a.reverse();
  //create a string from array using join()
  let jstr = r.join("");
  console.log(`   Reverse : ${jstr}`);
  if(jstr == sl ){
    console.log(" :  true")
    return true;
    console.log(" :  false")
    return false;


Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8.

Link to the challenge:

One of the tests for Palindrome is :palindrome(“1 eye for of 1 eye.”) should return false.
once the '1’s are removed from the string it reads “eyeforofeye” which is a palindrome.
but the question indicates that it should not be a palindrome.

This question comes up a lot, but it’s because of something said in the question:

You’ll need to remove all non-alphanumeric characters

The number 1 then shouldn’t be removed, and of course then 1eyeforof1eye is not the same as eye1forofeye1