Forked from anonymous/bonfire-check-for-palindromes.js
Created
December 1, 2015 03:03
-
-
Save dbess1/a05c83a6dcdbe07b9665 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/dbess1 '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: @dbess1 | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function palindrome(str) { | |
var word = str.toLowerCase().replace(/[\W_]/g, ""); | |
var reversedWord = word.split("").reverse().join(""); | |
return word === reversedWord; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment