// 回文数判断
let f = function(n) {
let res = 0;
let origin = n;
if(n/10<1) return true;
let ten = 1;
while(n) {
let num = n%10;
res = res*10 + num;
n/=10;
n = Math.floor(n);
}
console.log(res);
return origin===res;
}
console.log(f(10001))
网友评论