how to round number down in javascript code example
Example 1: javascript round down
Math.floor(x);
Example 2: javascript round .5 down
//standard round function, except round .5 down instead of up
function roundHalfDown(num) {
return -Math.round(-num);
}
roundHalfDown(1.5);// 1
roundHalfDown(1.6);// 2