ES6 - Fonction mathématique round ()

Il arrondit le nombre à l'entier le plus proche.

Syntaxe

Math.round( x ) ;

Paramètre

  • X - représente un nombre

Exemple

console.log("---Math.round()---") 
console.log("Math.round(7.2) : "+Math.round(7.2)) 
console.log("Math.round(-7.7) : "+Math.round(-7.7))

Production

---Math.round()--- 
Math.round(7.2) : 7 
Math.round(-7.7) : -8