题解 | #整数反转#
整数反转
http://www.nowcoder.com/practice/eceaa68482354edf9c3409c5b3e942b9
function _reverse(number) {
// 补全代码
let res = number<0? '-'+reNum(number):reNum(number)
return Number(res);
function reNum(num){
let res = '';
num = Math.abs(num);
while(num>0){
res += (num%10);
num = Math.floor(num/10);
}
return res;
}
}