我有以下基本Javascript来反转我使用时工作的数字
while (!no == 0)
但是当我使用时不起作用
while (!no === 0)
我已经尝试在控制台中只parseInt(0)返回,number而我no已经是number这样
为什么
===不工作,有人可以帮助并更好地解释我吗?
function findRepeated(number) {
var a, no, b, temp = 0;
no = parseInt(number);
while (!no == 0) {
a = no % 10;
no = parseInt(no / 10);
temp = temp * 10 + a;
}
return temp;
}
console.log(findRepeated(123));Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
80 次 |
| 最近记录: |