Forked from mtroiani/gist:81ad68a1f19027086ed2
Last active
December 11, 2015 20:52
-
-
Save tcarrio/255d2969a41d5c426c9b to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mtroiani 's solution for Bonfire: 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
// Bonfire: Check for Palindromes | |
// Author: @mtroiani | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function palindrome(str) { | |
str = str.toLowerCase().replace(/[^\w]|_/g, ""); | |
return (str === str.split("").reverse().join("")); | |
} | |
palindrome("A man, a plan, a canal. Panama"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment