js:Math.round

Un article de Polydoc.

Sommaire

[modifier] Synopsis

integer Math.round(float <<nombre>>)

[modifier] Description

La méthode round de l'objet Math retourne le nombre <<nombre>>, arrondi à l'entier le plus proche.

[modifier] Exemples

var x = Math.round(5.78);      // x vaut 6
x = Math.round(10.14);         // x vaut 10
x = Math.round(15);            // x vaut 15
x = Math.round(-3.26);         // x vaut -3
x = Math.round(0);             // x vaut 0

[modifier] Voir aussi

[modifier] Liens internes