Created
June 28, 2016 03:05
-
-
Save DougCal/9a6899ae522f959a68b92357bf746a44 to your computer and use it in GitHub Desktop.
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
function palindrome(str) { | |
// Good luck! | |
var datArray = []; | |
var blank = []; | |
var isItPalin = ""; | |
datArray = str.split(""); | |
blank = datArray.reverse(); | |
isItPalin = blank.join(""); | |
var purgePrep = /w+/; | |
var purgedStr = str.match(purgePrep); | |
var purgedIsItPalin = isItPalin.match(purgePrep); | |
if(purgedIsItPalin === purgedStr) | |
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