round()

The round() method is used to round the given number to the nearest whole number (an integer). If the number is a fraction of XX.5 or higher, the method rounds the number to the next highest integer. If the number is a fraction any value less than XX.5, the method rounds the number to the next lower integer.

syntax:

Math.round(number)

EXAMPLE

document.write("The number 4.32 rounded with the round() method, is : " + Math.round(4.32) )

The example is a document.write statement which rounds the number 4.32 to its nearest whole integer. The result is as follows:



The number 4.32 rounded with the round() method, is 4