I want to validate a textbox which rounds to two decimal places. However, I do not want to round up.
For example; if I enter 19.999 then the result will be 19.99, not 20.00
And if I enter 19.7, then result will be 19.70. If I enter 19, then result will be 19.00
The toFixed() function is not working in my code.
Can someone please help me with this?
Using substring to avoid building an intermediate array.
Use as
withPrec(10.00001, 2)orwithPrec(1, 5);