One decimal place without rounding

Keep one significant digit without rounding;

Example: 199.999

processed as follows

var str = parseFloat(199.999).toFixed(10) ;//Writing 10 here is to ensure that when several decimal places are reserved, the decimal place after him is 0 and will not be rounded, so the result is the desired result

var num = str.substring(0,str.lastIndexOf('.')+2)+"万";

After the following processing, num becomes 199.9

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327072104&siteId=291194637