Returns a number rounded to the nearest integer.
Syntax
round(value)
Parameters
Return value
A number.
Discussion
- If the fractional part is less than 0.5, the result is rounded to the nearest absolute integer.
- If the fractional part of the number is greater than 0.5, the result is rounded to the nearest largest absolute integer.
- If the fractional part is equal to 0.5, the result is rounded to the next integer in the direction of +Infinity.
Examples
Math.round(10.4)
10
Math.round(-10.4)
10
Math.round(10.5)
11
Math.round(-10.5)
-10
Math.round(10.9)
11
Math.round(-10.9)
-11
See also