Created
August 6, 2015 03:53
-
-
Save usmanity/72d67ad9c48475bae719 to your computer and use it in GitHub Desktop.
a simple gist for finding a palindrome in javascript
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(p){ | |
if (p.length == 0 || p.length == 1) { | |
return true; | |
} else if (p[0] == p[p.length - 1]) { | |
return isPalindrome(p.slice(1, p.length - 1)); | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment