Team LiB   Previous Section   Next Section
Math.round( ) round to the nearest integer

Availability

JavaScript 1.0; JScript 1.0; 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.

    Team LiB   Previous Section   Next Section