[removed] Round up to the next multiple of 5

后端 未结 8 988
[愿得一人]
[愿得一人] 2020-12-02 09:39

I need a utility function that takes in an integer value (ranging from 2 to 5 digits in length) that rounds up to the next multiple of 5 instead of the

8条回答
  •  感情败类
    2020-12-02 09:55

    const fn = _num =>{
        return Math.round(_num)+ (5 -(Math.round(_num)%5))
    }
    

    reason for using round is that expected input can be a random number.

    Thanks!!!

提交回复
热议问题