Created
June 28, 2016 06:05
-
-
Save avishwakarma/75127c00dfe9b897389f5bb80c47dd36 to your computer and use it in GitHub Desktop.
Check if a number or string is palindrome
This file contains hidden or 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
| /** | |
| * isPalindrome - function to check if a number or string is palindrome | |
| * @uses isPalindrome(141) // true | |
| */ | |
| function isPalindrome(str){ | |
| return (str + "").split("").reverse().join("") == (str + ""); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment