Returns a supplied numeric expression rounded to the nearest integer.
SyntaxMath.round( number )
Examples
Math.round(0.8);
Math.round(2.2);
Math.round(2.5);
Math.round(4);
Math.round(-1.5);
Remarks
The required number argument is the value to be rounded to the nearest integer.
For positive numbers, if the decimal portion of number is 0.5 or greater, the return value is equal to the smallest integer greater than number. If the decimal portion is less than 0.5, the return value is the largest integer less than or equal to number.
For negative numbers, if the decimal portion is exactly -0.5, the return value is the smallest integer that is greater than the number.
For example, Math.round(8.5)
returns 9, but Math.round(-8.5)
returns -8.
Microsoft Developer Network: Windows Internet Explorer JavaScript reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4