ceil javascript code example

Example 1: javascript ceiling

var ceiling1 = Math.ceil(4.7); //5 
var ceiling2 = Math.ceil(-3.4); //-3

Example 2: js ceil

Math.ceil(1.2);
// 2

Example 3: How does Math.ceil work

Math.ceil(x); //This equals the next whole number after x. X must be a double.

//Example use:
x = Math.ceil(x);
//Now x is equal to x rounded up.

Example 4: javascript math ceiling function

Math.ceil()

Example 5: ceil

ceil ( float $value ) : float
Returns the next highest integer value by rounding up value if necessary.