round up js code example
Example 1: rounding off in javascript
var avg=10.55;
console.log(Math.round(avg)); //Prints 11
Example 2: javascript ceiling
var ceiling1 = Math.ceil(4.7); //5
var ceiling2 = Math.ceil(-3.4); //-3
Example 3: round up javascript
Math.round(3.14159) // 3
Math.round(3.5) // 4
Math.floor(3.8) // 3
Math.ceil(3.2) // 4
Example 4: round down the number javascript
+3.5 => +3.0
-3.5 => -4.0
+3.5 => +3.0 using Math.floor()
-3.5 => -3.0 using Math.ceil()