Skip to content

Instantly share code, notes, and snippets.

@smoothness
Created January 14, 2015 18:29
Show Gist options
  • Save smoothness/4fdefb72688b75a6492f to your computer and use it in GitHub Desktop.
Save smoothness/4fdefb72688b75a6492f to your computer and use it in GitHub Desktop.
isPalindrome recursive function from Secrets of the JavaScript Ninja
function isPalindrome(text) {
if (text.length <= 1) return true;
if (text.charAt(0) != text.charAt(text.length - 1)) return false;
return isPalindrome(text.substr(1, text.length - 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment