📜  redondear decimales javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:19.038000             🧑  作者: Mango

代码示例1
console.log(Math.round(0.9));
// expected output: 1

console.log(Math.round(5.95), Math.round(5.5), Math.round(5.05));
// expected output: 6 6 5

console.log(Math.round(-5.05), Math.round(-5.5), Math.round(-5.95));
// expected output: -5 -5 -6