Math.ceil() in javascript

     The Math.ceil() function returns the smallest integer greater than or equal to a given number. ceil() is a static method of Math, you always use it as Math.ceil(), rather than as a method of a Math object you created (Math is not a constructor).

Syntax

   Math.ceil(number);


Example

   Math.ceil(.97);   // 1

   Math.ceil(0.3);     // 1

   Math.ceil(3);     // 3

   Math.ceil(7.003); // 8


Example Program:- (Editor)


Editor is Loading...

Advertisement

0 nhận xét:

Đăng nhận xét