我有这个用于测验程序的 javascript 代码,但我不知道如何返回最后一个上下文行的计算结果,只有 1 个小数。有什么建议么 ?
EndQuiz=function(){
canvas.removeEventListener('click',ProcessClick,false);
context.drawImage(quizbg, 0,0,550,90,0,0,550,400);
context.font = "20pt Georgia,Arial";
context.fillText("Thanks for finishing. ",20,80);
context.fillText("This is how good you were:",20,120);
context.font = "16pt Georgia,Calibri,Arial";
context.fillText("Correct answers: "+String(rightanswers)+" of "+String(rightanswers+wronganswers),20,180);
context.fillText("Correct: "+String(rightanswers/(wronganswers+rightanswers)*100)+"%",20,240);1