-1
我想得到不超过2位小数的最大百分比。这样总得分即时得到输出是26.666666666666668%如何在JavaScript中获得2位小数的百分比
期望的输出26.66%
if(pos >= questions.length){
test.innerHTML = "<h2>You gave "+correct+" CORRECT answers out of "+questions.length+" questions </h2><br/><h3>Total Score is "+correct/questions.length * 100 +" %</h3>";
_("test_status").innerHTML = "Quiz 1 Completed";
pos = 0;
correct = 0;
return false;
}
'(正确/ questions.length * 100).toFixed(2)' – Satpal