// Use Math.ceil() Math.ceil(1.2); // --> 2 Math.round(1.5); // --> 2 Math.round(1.4); // --> 1 Math.floor(1.8); // --> 1
var avg=10.55; console.log(Math.round(avg)); //Prints 11
//rounds a number to the nearest integer Math.round(2.6); // 3 Math.round(2.49); //2 Math.round(2.5); //3
Math.round(2.5);
+3.5 => +3.0 -3.5 => -4.0 +3.5 => +3.0 using Math.floor() -3.5 => -3.0 using Math.ceil()