Last active
November 27, 2016 20:55
-
-
Save Hoxtygen/eef5600b24ef101fb75d64f076a64a8f to your computer and use it in GitHub Desktop.
This is a solution to the FCC bonfire palindrome challenge
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(/\W|_/g, "").toLowerCase(); | |
str = str.split(" ").join(" "); | |
var NewStr = str.split("").reverse().join(""); | |
if (str === NewStr) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
palindrome("_eye"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment