Why isn't my code working?

I’m trying to do the palindrome checker , but it isn’t working for half of the tests.

  const ogstring = str;
  const rvstring = str.split('').reverse().join('')

  return rvstring === ogstring ? true: false;
}

Which tests is it failing?

Remember that you have to account for capitalization and white space - I suspect this is your main issue.

1 Like

I’ll try, Thanks!
.trim for whitespace maybe?

There are different ways to do it. Personally, I’d suggest looking into the .replace() method.

1 Like

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