const num = 18.186;
let result;
result = num.toFixed(2)
console.log(result)  // 18.19

注意,返回值为String类型

相关文章:

  • 2021-08-21
  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
猜你喜欢
  • 2021-11-11
  • 2021-12-18
  • 2021-08-31
  • 2021-06-02
  • 2021-12-18
  • 2021-12-18
相关资源
相似解决方案