palindrome javascript number code example
Example: js palindrome number
isPalindrome = function(x) {
if (x < 0) {
return false;
}
return x === reversedInteger(x, 0);
};
reversedInteger = function(x, reversed) {
if(x<=0) return reversed;
reversed = (reversed * 10) + (x % 10);
x = Math.floor(x / 10);
return reversedInteger(x, reversed);
};