Skip to content

Instantly share code, notes, and snippets.

@Hoxtygen
Last active November 27, 2016 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hoxtygen/eef5600b24ef101fb75d64f076a64a8f to your computer and use it in GitHub Desktop.
Save Hoxtygen/eef5600b24ef101fb75d64f076a64a8f to your computer and use it in GitHub Desktop.
This is a solution to the FCC bonfire palindrome challenge
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