js四舍五入

用X.toFixed(2)是5舍6入的,

function xround(x, num){
return Math.round(x * Math.pow(10, num)) / Math.pow(10, num) ;
}

xround(X,2)这样才是四舍五入

posted @ 2017-07-19 11:37  小赖皮  Views(95)  Comments(0Edit  收藏  举报