// Use Math.ceil() Math.ceil(1.2); // --> 2 Math.round(1.5); // --> 2 Math.round(1.4); // --> 1 Math.floor(1.8); // --> 1
Math.floor(x);
Math.round(2.5);
Math.round(var);
+3.5 => +3.0 -3.5 => -4.0 +3.5 => +3.0 using Math.floor() -3.5 => -3.0 using Math.ceil()