javascript math round up code example
Example 1: round up number typescript
var n = 4.3;
alert(Math.ceil(n));
Example 2: javascript ceiling
var ceiling1 = Math.ceil(4.7);
var ceiling2 = Math.ceil(-3.4);
Example 3: round up javascript
Math.round(3.14159)
Math.round(3.5)
Math.floor(3.8)
Math.ceil(3.2)
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()
Example 5: math.round js
console.log(Math.round(0.9));
console.log(Math.round(5.95), Math.round(5.5), Math.round(5.05));
console.log(Math.round(-5.05), Math.round(-5.5), Math.round(-5.95));