Parameters or Arguments
number The number used to locate the smallest integer.
The ceil() function returns the smallest integer fee that is higher than or equal to a number.
Math is a placeholder object that carries mathematical functions and constants of which ceil() is one of these functions.
console.log(Math.ceil(32.65)); console.log(Math.ceil(8.1)); console.log(Math.ceil(-4.2));
In this example, we have invoked the ceil() feature using the Math class.
We have written the output of the ceil() function to the internet browser console log, for demonstration purposes, to show what the ceil() characteristic returns.
The following will be output to the internet browser console log:
33 9 -4
In this example, the first output to the console log lower back 33 which is 32.65 rounded up to an integer value.
The second output to the console log back 9 which is 8.1 rounded up to an integer value.
The 0.33 output to the console log again -4 which is -4.2 rounded up to an integer value. Notice that when dealing with bad numbers, the ceil() feature rounds up towards zero and in this case, again -4 and now not -5.