js Find Longest Palindrome code example
Example 1: 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);
};
Example 2: how to solve palindrome problem in javascript
function palindrome(str) {
return true;
}
palindrome("eye");