Created
January 23, 2018 05:21
-
-
Save arrbxr/4a8967e6e965295b037dd20ff0ead2b0 to your computer and use it in GitHub Desktop.
palindrome check created by arrbxr - https://repl.it/@arrbxr/palindrome-check
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) { | |
str = str.toLowerCase().replace(/[\w]/g, ''); | |
for(var i = 0, len = str.length - 1; i < len/2; i++) { | |
if(str[i] !== str[len-i]) { | |
return false; | |
} | |
} | |
return true; | |
} | |
palindrome("ey_e"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment