小编Apu*_*ria的帖子

为什么 parseInt 向 toFixed 返回不同的结果?

console.log(typeof(parseInt((0.1 + 0.2).toFixed(1)))); // number
console.log((0.1 + 0.2).toFixed(1) == 0.3); // true
console.log((parseInt((0.1 + 0.2).toFixed(1))) === 0.3); // false
Run Code Online (Sandbox Code Playgroud)

有人可以解释为什么最后一个语句不返回 true 吗?

javascript

1
推荐指数
1
解决办法
68
查看次数

标签 统计

javascript ×1