我意识到这与案例有关,我该如何解决,或者您能否建议一种更好的方法来获得我想要的最终产品,任何帮助都会很好
function main()
{
var a;
var answer;
a = prompt("Test Score One Out of 20", a);
var b;
b = prompt("Test Score Two Out of 20", b);
var c;
c = prompt("Test Score Three Out of 20", c);
answer = parseInt(a,10) + parseInt(b,10) + parseInt(c,10);
switch(answer)
{
case "answer >= 52":
alert("You got an A");
break;
case "answer >= 42":
alert("You got a B");
break;
case "answer >= 33":
alert("You got a C");
break;
case "answer <= 32":
alert("You got a D");
break;
default:
alert("Failed");
break;
}
}