ES6 - Fonction Math floor ()

Le plancher de x: le plus grand entier inférieur ou égal à x.

Syntaxe

Math.floor( x ) ;

Paramètre

  • X - représente un nombre

Exemple

console.log("---Math.floor()---") 
console.log("Math.floor(2.8) : "+Math.floor(2.8)) 
console.log("Math.floor(-3.2) : "+Math.floor(-3.2))

Production

---Math.floor()--- 
Math.floor(2.8) : 2 
Math.floor(-3.2) : -4