Created
March 16, 2017 21:16
-
-
Save lachlan-eagling/04d07f43081f3bb2344aa798d688098f to your computer and use it in GitHub Desktop.
This file contains hidden or 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) { | |
| str = str.replace(/[^a-z\d]+/gi, '').toLowerCase(); | |
| var reversed = ""; | |
| for(var i = str.length - 1; i >= 0; i--){ | |
| reversed += str[i]; | |
| } | |
| return str === reversed; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment