JavaScript Math.round()
The Math.round(x) method used to returns the rounded to the nearest integer.
Syntax
Math.round(x)
Here, round() is a static method. Hence, we use it as Math.round().
Parameters- x - (Required).A number.
- Number - The value of x rounded to the nearest integer.
Example
console.log(Math.round(10.5)); //11 console.log(Math.round(10.2)); //10 console.log(Math.round(10.7)); //11 console.log(Math.round(-10.5)); //-10 console.log(Math.round(-10.2)); //-10 console.log(Math.round(-10.7)); //-11Try it Yourself