假设我有一个值15.7784514,我想显示它15.77,没有舍入.
var num = parseFloat(15.7784514);
document.write(num.toFixed(1)+"<br />");
document.write(num.toFixed(2)+"<br />");
document.write(num.toFixed(3)+"<br />");
document.write(num.toFixed(10));
结果-
15.8
15.78
15.778
15.7784514000
如何显示15.77?