JavaScript(JS) math method - ceil

The ceil method in JavaScript's Math object returns the smallest integer greater than or equal to a given number.

The ceil method takes one argument, which is the number to be rounded up to the nearest integer. If the argument is not a number, it will be converted to one before the calculation. If the argument is NaN, NaN will be returned.

Here's an example usage:

‮t refer‬o:theitroad.com
const x = 3.14;
const ceilX = Math.ceil(x);
console.log(ceilX); // 4

In the above example, the Math.ceil method is used to round up the number 3.14 to the nearest integer. The result, which is 4, is then logged to the console.