Math.ceil() returns the smallest integer greater than or equal to a given number.

Note that if math.ceil (null) is run, this function will return the integer 0 without giving a NaN error.

Look at the following code:

console.log(Math.ceil(.95)); // expected output: 1 console.log(Math.ceil(4)); // Expected output: 4 console.log(math.ceil (7.004)); // Expected output: 8 console.log(math.ceil (-7.004)); // expected output: -7Copy the code

Note that if it’s a negative number, then getting an integer is an integer with the decimal part removed.

www.ossez.com/t/javascrip…