style: 格式化代码
This commit is contained in:
parent
1c724b7f7c
commit
75c7ba15a2
@ -50,7 +50,7 @@ const isPalindrome = function (x) {
|
|||||||
if (x < 0 || (x % 10 === 0 && x !== 0)) return false;
|
if (x < 0 || (x % 10 === 0 && x !== 0)) return false;
|
||||||
let revertedNumber = 0;
|
let revertedNumber = 0;
|
||||||
while (x > revertedNumber) {
|
while (x > revertedNumber) {
|
||||||
revertedNumber = revertedNumber * 10 + x % 10;
|
revertedNumber = (revertedNumber * 10) + (x % 10);
|
||||||
x = Math.floor(x / 10);
|
x = Math.floor(x / 10);
|
||||||
}
|
}
|
||||||
// 当数字为奇数位时revertedNumber会大于x,只要/10之后任然相等,那么就是回问数
|
// 当数字为奇数位时revertedNumber会大于x,只要/10之后任然相等,那么就是回问数
|
||||||
|
Loading…
x
Reference in New Issue
Block a user