Check for Palindromes works everywhere but here

Hi, my algorithm for the “Check for Palindromes” works in Chrome Developer console and other online tools, but not here in freecodecamp. What’s going on here?

Your code so far

function palindrome(string) {
  string = string.toLowerCase();
  var charactersArr = string.split(" ");
  var validCharacters = "abcdefghijklmnopqrstuvwxyz".split(" ");
 var lettersArr = [];
 charactersArr.forEach(char => {
   if (validCharacters.indexOf(char) > -1 ) letterArr.push(char);

if (lettersArr.join(" ") === lettersArr.reverse().join(" ")) return true;

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:55.0) Gecko/20100101 Firefox/55.0.

Link to the challenge:

It looks like you’re always returning true:

1 Like