Name
Math.round( ): round to the nearest integer â ECMAScript v1
Synopsis
Math.round(x
)
Arguments
-
x
Any number.
Returns
The integer closest to x
.
Description
Math.round( )
rounds its
argument up or down to the nearest integer. It rounds .5 up. For
example, it rounds 2.5 to 3 and rounds â2.5 to â2.
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.