精确到指定位数的小数

const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`)

原文地址:https://www.cnblogs.com/wuqilang/p/15103728.html