Created
July 28, 2017 23:22
-
-
Save mowamed/f0d3b2a0d2860c517477b7220b7014ab to your computer and use it in GitHub Desktop.
palindrome created by mowamed - https://repl.it/Jn8h/0
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 newStr = str.replace(/\d|\s|\W|_/g, ''); | |
newStr = newStr.toLowerCase(); | |
var myArray = newStr.split(''); | |
if (myArray[0] == myArray[myArray.length - 1]) { | |
return true | |
} | |
return false; | |
} | |
palindrome("eye kfgkdsvlksvjsd"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment