I am developing an application which deals with decimals. I have numbers like 8.0467.where i used number.toFixed(2) to get the number of digits after the decimal.
But if i have just 8 its showing 8.00
8.00 should give 8, 8.01 should give 8.01, 8.009 should give 8.01.
For 8.00 to 8,You need to simply right condition that if after decimal,Value is 00 then remove it. and for other requirements,you can use
e.source.value= Math.round((e.source.value) *10 )/10; e.source.value=e.source.value.toFixed(2);
Think you can help? Login to answer this question!