Answer the question
In order to leave comments, you need to log in
rounding values in javascript
I need a script that allows rounding values.
For example:
23 in 25
52 in 50
110 in 100.
The main thing is that the number is a multiple of 25.
Maybe someone knows how? or do you have any work?
Answer the question
In order to leave comments, you need to log in
function round(n) {
var func = n % 25 < 25/2 ?
Math.floor : Math.ceil;
return func(n/25)*25;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question