oFixed() 方法可把 Number 四舍五入为指定小数位数的数字。

在本例中,我们将把数字舍入为仅有一位小数的数字:

Show the number 13.37 with one decimal:
<script type="text/javascript">
var num = new Number(13.37);
document.write (num.toFixed(1))
</script>

输出:

Show the number 13.37 with one decimal:
13.4

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
猜你喜欢
  • 2022-01-24
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案