保留多位小数并四舍五入 叫我小窝吧 2024-04-07 54 阅读1分钟 /** * num 原数据 * place 保留的位数 */ function roundToPlace(num, place) { return Math.round(num * Math.pow(10, place)) / Math.pow(10, place) }