Skip to content

Instantly share code, notes, and snippets.

@dimabory
Last active April 3, 2019 11:08
Show Gist options
  • Save dimabory/7f923c249bdfd82a7c202c7ee69c86fb to your computer and use it in GitHub Desktop.
Save dimabory/7f923c249bdfd82a7c202c7ee69c86fb to your computer and use it in GitHub Desktop.
palindrome in the one line
const palindrome = str =>
(s = str.toLowerCase().replace(/[\W_]/g, '')) &&
s === [...s].reverse().join('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment