How can rounding be done in JavaScript?
In JavaScript, you can use the Math.round() method to round numbers. For example:
var num = 10.6;
var roundedNum = Math.round(num);
console.log(roundedNum); // 输出:11
The Math.round() method will round the parameter to the nearest integer value. If the decimal part of the parameter is greater than or equal to 0.5, it will round up; otherwise it will round down.