The Math.ceil()
function rounds a number up to the next largest integer.
Math.ceil(null) returns integer 0.
Math.ceil(x) // x is a number.
let a = Math.ceil(.95); // 1 console.log(a);/*from w ww. jav a 2s . co m*/ a = Math.ceil(4); // 4 console.log(a); a = Math.ceil(7.124); // 8 console.log(a); a = Math.ceil(-0.95); // -0 console.log(a); a = Math.ceil(-4); // -4 console.log(a); a = Math.ceil(-7.124); // -7 console.log(Math.ceil(25.9)); // 26 console.log(Math.ceil(25.5)); // 26 console.log(Math.ceil(25.1)); // 26