Skip to content

Instantly share code, notes, and snippets.

@TechWithTy
Created October 12, 2020 03:07
Show Gist options
  • Save TechWithTy/7346edf8b39009d025aacd3f14545ed0 to your computer and use it in GitHub Desktop.
Save TechWithTy/7346edf8b39009d025aacd3f14545ed0 to your computer and use it in GitHub Desktop.
Find out if value is a palindrome
/**
* @param {number} x
* @return {boolean}
*/
var isPalindrome = function(x) {
let reversedNum = 0
//Passes
if(x < 0){
return false;
}else{
reversedNum = x.toString().split('').reverse().join('');
return (x == reversedNum ? true: false);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment