Hay, i need a hand.
I want to convert all numbers to the nearest .25
So...
5 becomes 5.00
2.25 becomes 2.25
4 becomes 4.00
3.5 becomes 3.50
Thanks
Hay, i need a hand.
I want to convert all numbers to the nearest .25
So...
5 becomes 5.00
2.25 becomes 2.25
4 becomes 4.00
3.5 becomes 3.50
Thanks
Multiply by 4, round to integer, divide by 4 and format with two decimals.
Edit Any reason for the downvotes? At least leave a comment to know what should be improved.
Here’s an implementation of what rslite said:
var number = 5.12345;
number = (Math.round(number * 4) / 4).toFixed(2);