I have a javacript output 14.85 now i want to make it 14.90 for 14.85 and for 14.84 i need it to 14.80, Is it possible ?
thanks
I have a javacript output 14.85 now i want to make it 14.90 for 14.85 and for 14.84 i need it to 14.80, Is it possible ?
thanks
Here is the solution that produces the exact result what you need:
function roundFloat(n) {
return (Math.round(n * 10) / 10).toFixed(2);
}
roundFloat(14.84); // "14.80"
roundFloat(14.85); // "14.90"