let grades = [85, 93, 96, 90, 81, 97, 88, 93, 86, 83];
let Avg;
let Min;
let Max;
let SelectOption;
SelectOption = prompt("Which option would you like to select from below?
Avg : Average Grade
Min : Minimum Grade
Max : Maximum Grade
");
function displayGrades(grades) {
for (let i = 0; i < grades.length; i++) {
if (grades[i] > 0) {
console.log("Available Grades " + " : " + Grades[i] );
} else {
console.log("No Grades Available " );
}
}
};
displayGrades(grades);
function calculateGrades(grades) {
let totalGrades = 0;
let numGrades = grades.length;
let Avg;
let Min;
let Max
for (let element of grades) {
totalGrades = totalGrades + element;
}
Avg = Math.round(totalGrades / numGrades);
return [totalGrades, Avg];
};
Min = Math.Min(Grades);
return [Grades, Min];
};
Max = Math.Max(Grades);
return [Grades, Max];
};
let results = calculateGrades(grades);
console.log ("The average of the grade is: " + results[1]);
console.log ("The lowest grade is: " + results[2]);
console.log ("The highest grade is: " + results[3]);
please correct the code