Idea: First turn the number into a string, then turn it into a string array, and then (for reverse order) the algorithm and then turn it into a string comparison.
/**
* @param {number} x
* @return {boolean}
*/
var isPalindrome = function(x) {
var xxx=x.toString();
var xx=xxx.split('');
var xxxx=[];
for(var i=xx.length-1;i>=0;i--)
{
xxxx.push(xx[i]);
}
if(xxxx.join('')==xx.join(''))
{
return true;
}
else
{
return false;
}
};