round
The Math.round() method rounds a number to the nearest integer.
Syntax
Math.round(x)
Returns
The value of x rounded to the nearest integer.
Parameters
- x (float)
- A number.
Usage
If you like to round to specific decimal, try:
function round2(v)
{
return Math.round(v*100)/100;
}