正文

让JavaScript中的数字0保留两位小数,可以使用`toFixed()`方法。以下是一个示例: ```javascript let num = 0; let formattedNum = num.toFixed(2); console.log(formattedNum); // 输出: