Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Last active April 12, 2019 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gladchinda/74dbc30af4f6d01a81e6d874f836c307 to your computer and use it in GitHub Desktop.
Save gladchinda/74dbc30af4f6d01a81e6d874f836c307 to your computer and use it in GitHub Desktop.
function isPalindrome(word) {
return (
!!(word && Object.prototype.toString.call(word) === '[object String]')
&& (
word.length <= 1
|| RegExp(word[0], 'i').test(word.slice(-1))
&& isPalindrome(word.slice(1, -1))
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment