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;
}
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.
I’ll try, Thanks!
.trim for whitespace maybe?
There are different ways to do it. Personally, I’d suggest looking into the .replace() method.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.