js百分比计算

//百分比计算
function GetPercent(num, total) {
    num = parseFloat(num);
    total = parseFloat(total);
    if (isNaN(num) || isNaN(total)) {
        return 0;
    }
    return total <= 0 ? "0%" : (Math.round(num / total * 10000) / 100.00);
}
原文地址:https://www.cnblogs.com/wangshengli520/p/14986422.html