JavaScript tutorial:
round method

 

Applies to: Math Object

The round method is use to get a supplied numeric expression rounded to the nearest integer.

Syntax

Math.round(number)

The number argument is the value to be rounded to the nearest integer.

Return value

Returns a supplied numeric expression rounded to the nearest integer.

Example

If the decimal portion of number is 0.5 or greater, the return value is equal to the smallest integer greater than number. Otherwise, round returns the largest integer less than or equal to number.

See also: Math Object Methods