【算法】判断回文数 By Paddy 发表于 2017-03-30 判断一个整数是否是回文数 @param {number} x@return {boolean} 12345678910111213141516var isPalindrome = function(x) { /** * 首先将数字反转 然后判断是否相等 */ var tempX = x; var reverseX = 0; if(x < 1e+32){ while(x > 1 || x < -1){ reverseX = reverseX * 10 + parseInt(x % 10); x /= 10; } } return tempX === reverseX;};console.log(isPalindrome(-1234321));