js保留两位小数点

console.log(Math.floor(2547.2548 * 1000) / 1000)  // 2547.254

console.log(Math.floor(2547.2548 * 100) / 100)  // 2547.25

console.log(Math.floor(2547.2548 * 10) / 10) // 2547.2

posted @ 2022-02-23 10:37  sosolucky  阅读(31)  评论(0编辑  收藏  举报