ES6 - Math ceil() Function


Advertisements


This method returns the smallest integer greater than or equal to a number.

Syntax

Math.ceil ( x ) ;       

Parameter

  • X − represents a number

Example

console.log("---Math.ceil()---") 
console.log("Math.ceil(2.2) : "+Math.ceil(2.2)) 
console.log("Math.ceil(-3.8) : "+Math.ceil(-3.8))          

Output

---Math.ceil()--- 
Math.ceil(2.2) : 3 
Math.ceil(-3.8) : -3         

es6_math.htm

Advertisements