Skip to content

Instantly share code, notes, and snippets.

Created December 11, 2015 02:08
Show Gist options
  • Save anonymous/5d22486d635c0ce53cb7 to your computer and use it in GitHub Desktop.
Save anonymous/5d22486d635c0ce53cb7 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/thetinybeaker 's solution for Bonfire: Check for Palindromes
// 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