JavaScript toFixed, 实现四舍五入保留两位小数

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

注意,返回值为String类型