Javascript [Electronic resources] : The Definitive Guide (4th Edition)

David Flanagan

نسخه متنی -صفحه : 844/ 302
نمايش فراداده

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.