Home > Article > Web Front-end > Keep to one decimal place without rounding
Retain one significant figure 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 little one’s number is 0 without rounding, so the result is what you want
var num = str.substring(0,str.lastIndexOf('.')+2) +"万";
After the following processing, num becomes 199.9