Created
October 27, 2016 15:44
-
-
Save weblancaster/0861f7070a3a44866ab8cae9a5c62584 to your computer and use it in GitHub Desktop.
Check if string is palindrome in Javascript.
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 isPalindrome(str) { | |
str = str.replace(/\W/g).toLowerCase(); | |
return str === str.split('').reverse().join(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment