javascript - How to round an integer number (keeping multiples of 5 as they are) -
i want round integer number, keep multiples of 5 instead of rounding either or down.
in first case if 35, after split 30 , 5, 5<=5 result should 35. in second case if 37, after split 30 , 7, 7>5 result should 40.
can on this? wish in javascript.
try this....i hope looking for..
function getval(x) { return math.round(x% 10 > 5 ? math.round(x/10)*10: math.round(x/10)*10+5); }
Comments
Post a Comment