round up javascript 1

round up javascript

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

Here is what the above code is Doing:
1. We’re creating a variable called floor1 and setting it equal to the result of Math.floor(4.7).
2. We’re creating a variable called floor2 and setting it equal to the result of Math.floor(-3.4).
3. We’re creating a variable called ceiling1 and setting it equal to the result of Math.ceil(4.7).
4. We’re creating a variable called ceiling2 and setting it equal to the result of Math.ceil(-3.4).

Similar Posts