Math.round()
ES1+Returns the value of a number rounded to the nearest integer.
Syntax
Math.round(x)Parameters
x number A number
Return Value
number
The value of the number rounded to the nearest integer
Examples
JavaScript
console.log(Math.round(4.5));
console.log(Math.round(4.4));
console.log(Math.round(-4.5)); Output:
// 5
4
-4