このコードを実行すると、INVALID(100以上)とHigh Distinctionのみが動作します。 80より下の数字には、High Distinctionも表示されます。私は何を間違えたのですか?複数のelse if文を実行
function calculateGrade() {
var fvalue = Number(prompt('Please enter final score for unit. Enter a whole number only'));
document.write('The final score entered is ' + fvalue + '<br />');
if (fvalue > 100) {
document.write('INVALID');
} else if (80 <= fvalue <= 100) {
document.write('High Distinction');
} else if (70 <= fvalue <= 79) {
document.write('Distinction');
} else if (60 <= fvalue <= 69) {
document.write('Credit');
} else if (50 <= fvalue <= 59) {
document.write('Pass');
} else if (0 <= fvalue <= 49) {
document.write('Fail');
} else if (fvalue < 0) {
document.write('INVALID');
}
}
calculateGrade()
これは 'java'ではありません!それが詳細なコードの場合。タグを削除しない場合。 – nullpointer