本文转自:https://blog.csdn.net/qq_40171039/article/details/79729503 保留两位小数且不四舍五入: 方法一: var a = 2.461; var b = ( parseInt( a * 100 ) / 100 ).toFixed(2); console.log(b); // 2.46 方法二: var a = -12.45; var b = parseFloat(a).toFixed(3); var result = b.sub…
js保留两位小数四舍五入: (Math.floor(until_price*100)/100).toFixed(2);//会四舍五入 保留两位小数 且不四舍五入(三种方式,请用最后一种): var num="2.999999999"; num = Number(num); num*=100; num = (Math.floor(num)/100).toFixed(2); alert(num); var a = "2.999999999"; a = a-0; a*…