Answers for "round to 1dp js including 0"

2

Javascript round number to nearest 5

function round5(x)
{
    return Math.ceil(x/5)*5;
}
Posted by: Guest on November-04-2020
0

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
Posted by: Guest on April-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language