**编写程序以计算成绩
**
```
let marks = [100,100,100];
console.log(calculateGrade(marks));
function calculateGrade(marks) {
var total = 0;
var sum = 0;
for (let total of marks)
sum +=total;
sum /= marks.length;
return (( sum <=59 || sum <=69 ? 'F' : 'D') && ( sum <=79 || sum <=89 ? 'C' : 'B'));
(sum >= 90)console.log('A');
}
答案 0 :(得分:0)
console.log(calculateGrade(marks));
function calculateGrade(marks) {
var total = 0;
var sum = 0;
for (let total of marks)
sum +=total;
average = sum / marks.length;
console.log(average);
// return ((((average = 0 && average <=59) && (average = 60 && average <=69) ? 'F' : 'D')) && (((average = 70 && average <=79) && (average = 80 && average <=89) ? 'C' : 'B')));
// else console.log('A');
if ( average < 60) return "F";
if ( average < 70) return "D";
if ( average < 80) return "C";
if ( average < 90) return "B";
return "A";
}