Check for Palindromes input

Tell us what’s happening:

My function works for most of the words like “eye” but whenever there’s a space or special character it fails can someone help me?

Your code so far

function palindrome(str) {
  var newString="";
  for(var i=str.length-1;i>=0;--i)
  return true;
  return false;


Your browser information:

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

Link to the challenge:

You should remove the chars that are not letters or numbers. Check out the replace() function and regular expressions to find out how to remove non-alphanumeric chars from a string.

1 Like