ES6 - Math floor() Function



The floor of x: the largest integer less than or equal to x.

Syntax

Math.floor( x ) ;      

Parameter

  • X − represents a number

Example

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

Output

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