Created
December 11, 2015 02:08
-
-
Save anonymous/5d22486d635c0ce53cb7 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/thetinybeaker 's solution for Bonfire: Check for Palindromes
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
// Bonfire: Check for Palindromes | |
// Author: @thetinybeaker | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function palindrome(str) { | |
var initString = str.toLowerCase().replace(/[\W_]/g,''); | |
var revString = initString.split('').reverse().join(''); | |
//return initString.concat(" "+revString); | |
if (initString === revString) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
palindrome("0_0 (: /-\ :) 0-0"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment