DEV Community

loading...

Discussion on: Vanilla JavaScript palindrome checker in 3 lines

Collapse
toanoop profile image
Anoop Sivadas

const checkPalin = words => words.split('').reverse().toString() === words.split('').toString()?'The word is a palindrome':'The Word is not a palindrome';

in a single line .....

Collapse
dailydevtips1 profile image
Chris Bongers Author

Yes nice one Anoop, was mentioned above as well, I just like to showcase the code more readable for new people 🤟

Forem Open with the Forem app