Created
March 16, 2012 05:20
-
-
Save rmariuzzo/2048608 to your computer and use it in GitHub Desktop.
Contest: 1 line of JS: Smallest Palindrome Checker
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
/** | |
* Check if a word or phrase is a palindrome in 106 characters of JavaScript. | |
*/ | |
function isPalindrome(s) { | |
return s.match(/[a-zA-Z]/g).join('').toLowerCase()==s.match(/[a-zA-Z]/g).reverse().join('').toLowerCase(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment