Palindrome Number

 1 var isPalindrome = function(x) {
 2     var xR = 0,
 3         xP = x > 0 ? x : -x;
 4 
 5     while (xP != 0) {
 6         xR = xR * 10 + (xP % 10);
 7         xP = Math.floor(xP / 10);
 8     }
 9 
10     return Math.abs(xR - x) < 0.000001;
11 };

 

posted @ 2015-12-24 20:31  叫我霍啊啊啊  阅读(69)  评论(0编辑  收藏  举报