var num = 5.56789; var n = num.toFixed(2); 参考: JavaScript toFixed() Method 转载于:https://my.oschina.net/fxtxz2/blog/3069107