gpt4 book ai didi

javascript - 从漂浮物上剪下过多的痕迹

转载 作者:行者123 更新时间:2023-12-03 16:24:37 45 4
gpt4 key购买 nike

我正在从 postgre db 中以浮点格式获取数字,当我试图在我的 html 页面中打印它们时,它们占用了太多空间。如何使用快速 JS 函数减少精度过高的数字?即:

98.7776 --> 98.7

最佳答案

var num = 98.7776;
var result = num.toFixed(1);

关于javascript - 从漂浮物上剪下过多的痕迹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7858085/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com