js round down to nearest integer 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: javascript floor
Math.floor(1.6);
result: 1
Example 3: calculate surface of a circle round to the nearest integer javascript
Math.round(Math.PI * radius * radius)