javascript round down to get 4 code example
Example 1: 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 2: run down number javascript
using Math.floor
console.log(Math.floor(5.95));
// expected output: 5
console.log(Math.floor(5.05));
// expected output: 5
console.log(Math.floor(5));
// expected output: 5
console.log(Math.floor(-5.05));
// expected output: -6