I’m trying to figure out the best way to solve rounding a number.
Basically I have this number: var weekMilliseconds = 604800000 (Number of milliseconds in a week)
I have another function that spits out a random number.
What I would like to do is based on the random number, I’d like to output the next multiple of weekMilliseconds.
For example:
if random # is 1: round up to 604800000
if random # is 604800001 round up to 1209600000 (604800000 * 2)
and so on…..
What is the best way to accomplish this.
Use
Math.ceil()(which gives you the next whole number up):