Created
January 23, 2019 02:32
-
-
Save hhenrichsen/2c299c81058c94393e06dae1dbc5b1cf to your computer and use it in GitHub Desktop.
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
var isPalindrome = (str) => | |
str.toLowerCase() | |
.split("").reduce((a, i) => a += (i.match(/^[A-Za-z0-9]/) ? i : ""), "") //Kill invalid characters. | |
.split("").reduce((a, i, idx, c) => a && i === c.pop(), true); //Check equivalency; Short circuit if needed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment