js求两个整数的百分比
function GetPercent(num, total) {
num = parseFloat(num);
total = parseFloat(total);
if (isNaN(num) || isNaN(total)) {
return "-";
}
return total <= 0 ? "0%" : (Math.round(num / total * 100) / 100.00);
}
耐得住寂寞,才能登得顶
Gitee码云:https://gitee.com/lyc96/projects