Home > Article > Web Front-end > Keep to one decimal place without rounding
Retain one significant digit without rounding;
For example: 199.999
is processed as follows
var str = parseFloat(199.999).toFixed(10);//Write 10 here to ensure that several decimal places are retained, after it The decimal point is 0 without rounding, so the result is what you want
var num = str.substring(0,str.lastIndexOf('.')+2)+"10,000";
After the following processing, num becomes 199.9