Last active
April 12, 2019 10:30
-
-
Save gladchinda/74dbc30af4f6d01a81e6d874f836c307 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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