/**
* @param {number} x
* @return {boolean}
*/
var isPalindrome = function(x) {
let a, b, c = 0;
a = x%10;
x=x-a;
b= x/10;
c= b%10;
let d = b-c;
let f = d/10;
let g = (a*100) + (c*10) + f;
if (g==x && x>0)
return "true";
else
return "false";
};
when the number is negative its not saying false, it says true instead. But i added x>0 condition. What’s the problem? And btw my code also doesn’t look good maybe it’s not a good way to solve the palindrome problem. And also i am not so sure if its working with numbers with more than 3 digits.