Created
February 2, 2017 16:44
-
-
Save tiberiur/64fe7c464fb31650441d93ca700a0e57 to your computer and use it in GitHub Desktop.
[JS] Check for Palindromes
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 palindrome(str) { | |
var text = str.replace(/[^0-9a-z]/gi, '').toLowerCase(), | |
reverseText = text.split("").reverse().join(""); | |
return text == reverseText; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment