问题描述
该数字定义为
const num = 10;
parseFloat
和+
与toFixed(1)
(在toFixed之后转换为整数)都返回
10
Number.parseFloat(num.toFixed(1)); // this in UI (at least in React) actually displays with several decimal (I must have read somewhere this is how the browser engine displays is)
+num.toFixed(1);
如果我只是使用
num.toFixed(1)
返回一个字符串。
是否可以在不转换成字符串和成字符串的情况下使用带有N的浮点数?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)