Skip to content

Instantly share code, notes, and snippets.

@avishwakarma
Created June 28, 2016 06:05
Show Gist options
  • Select an option

  • Save avishwakarma/75127c00dfe9b897389f5bb80c47dd36 to your computer and use it in GitHub Desktop.

Select an option

Save avishwakarma/75127c00dfe9b897389f5bb80c47dd36 to your computer and use it in GitHub Desktop.
Check if a number or string is palindrome
/**
* 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