DEV Community

Discussion on: JavaScript Katas: Is it a palindrome?

Collapse
 
rainson12 profile image
Rainson12 • Edited

I think you also only need to compare the string length /2 +1 in order to check whether it's a palindrome because the first half actually needs to be the same like the last half only in reverse order right? So a for loop and then accessing the index of the string for the length /2+1 might be the fastest solution?

Collapse
 
kosich profile image
Kostia Palchyk

yep, it would probably be the fastest solution