【js】百分比保留两位小数

function drawProgressNum(num, total) {
var leftWidth = (num / total) * 100;
//将百分比保留两位小数
var percentNum = (Math.round(leftWidth*100)/100).toFixed(2) + '%';
return percentNum;
}
posted @ 2017-10-12 13:46  Legolas_4  阅读(683)  评论(0编辑  收藏  举报