Round a number to the nearest integer:
The result will be:
More "Try it Yourself" examples below.
The round() method rounds a number to the nearest integer.
Note: 2.49 will be rounded down, 2.5 will be rounded up.
Method | |||||
---|---|---|---|---|---|
round() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
x | Required. The number to be rounded |
Return Value: | A Number, representing the nearest integer |
---|---|
JavaScript Version: | 1.0 |
Round different numbers to the nearest integer:
The result of a,b,c,d,e, and f will be: